mes/make/common.make
Jan Nieuwenhuizen 38d30a3e42 build: Refactor.
* GNUmakefile (OUT,QUIET,SUBDIRS): New variables.
  include make/common.make
* .gitignore: Remove toplevel targets.
* build-aux/compile-all.scm: Import from GNU Guix.
* configure (gulp-pipe): Check exit status.  Actually test for CC,
  CC32.
* make/bin.make: New file.
* make/check.make: New file.
* make/clean.make: New file.
* make/common.make: New file.
* make/compile.make: New file.
* make/guile.make: New file.
* make/mescc-guile.make: New file.
* make/mescc-mes.make: New file.
* make/reset.make: New file.
* lib/mlibc.c: Rename from top.
* lib/start.c: Rename from top.
* module/module.make: New file.
* scaffold/scaffold.make: New file.
* scripts/scripts.make: New file.
* src/mes.c: Rename from top.
* src/src.make: New file.
* src/mes.c: Rename from top.
* src/gc..c: Rename from top.
* src/lib.c: Rename from top.
* src/posix.c: Rename from top.
* src/reader.c: Rename from top.
* src/vector.c: Rename from top.
* tests/tests.make: New file.
2017-04-12 21:27:59 +02:00

50 lines
924 B
Makefile

.PHONY: all check clean distclean mostlyclean maintainer-clean install
cleaning?:=$(filter clean,$(MAKECMDGOALS))
ifeq ($(cleaning?),)
.config.make: configure $(filter-out .config.make,$(MAKEFILE_LIST))
./configure
endif
CC32:=arch-gcc
-include .config.make
CLEAN:=$(OUT)
DIST-CLEAN:=.config.make
MAINTAINER-CLEAN:=
CHECK:=
all: $(OUT)
include make/install.make
define subdir
ifneq ($(DEBUG),)
$$(info SUBDIR $(1))
endif
DIR:=$(patsubst %/,%,$(dir $(1)))
DOUT:=$(OUT)/$$(DIR)
include $(1)
endef
$(foreach dir,$(SUBDIRS),$(eval $(call subdir,$(dir)/$(dir).make)))
all: $(CLEAN)
ifneq ($(DEBUG),)
$(info CLEAN=$(CLEAN))
endif
subdirs: $(CLEAN)
check: $(CLEAN) $(CHECK)
include make/clean.make
CROSS_PREFIX:=$(CC32:%gcc=%)
ifeq ($(findstring clean,$(MAKECMDGOALS)),)
ifneq ($(DEBUG),)
$(info DEPS:=$(filter %.d %.$(CROSS_PREFIX)d,$(DIST-CLEAN)))
endif
-include $(filter %.d %.$(CROSS_PREFIX)d,$(DIST-CLEAN))
endif