|
@@ -28,35 +28,51 @@ _tail = $(wordlist 2,$(words $(1)),$(1))
|
|
|
_strip_flags = $(if $(1),$(call _strip_flags,$(call _tail,$(1)),$(subst $(word 1,$(1)),,$(2))),$(2))
|
|
|
strip_flags = $(if $(findstring -,$(word 1,$(2))),$(2),$(call _strip_flags,$(1),$(word 1,$(2))) $(call _tail,$(2)))
|
|
|
|
|
|
-RMAKE = $(MAKE) MAKEFLAGS='$(call strip_flags,r R,$(MAKEFLAGS))'
|
|
|
+RMAKE = +$(MAKE) MAKEFLAGS='$(call strip_flags,r R,$(MAKEFLAGS))'
|
|
|
|
|
|
riscv_configargs := target_configargs='--enable-lite-exit --disable-newlib-register-fini'
|
|
|
|
|
|
-all: gnu.riscv.build gnu.z80.build
|
|
|
+all: gnu
|
|
|
|
|
|
clean:
|
|
|
- rm -rf *.build *~ *.bak \#* .\#*
|
|
|
+ rm -rf *.build *~ *.bak \#* .\#* *.deps *.stamp
|
|
|
|
|
|
spotless: clean
|
|
|
rm -rf gnu
|
|
|
|
|
|
-.PHONY: src
|
|
|
-src:
|
|
|
- [ ! -f ../../.gitmodules ] || \
|
|
|
- git submodule update --init --recursive
|
|
|
+.PHONY: gnu.src
|
|
|
+gnu.src:
|
|
|
+ if [ -f ../../.gitmodules ] && \
|
|
|
+ git submodule status --recursive | grep -q '^[+-]'; then \
|
|
|
+ git submodule update --init --recursive ; \
|
|
|
+ rm -rf gnu gnu.*.stamp ; \
|
|
|
+ fi
|
|
|
+
|
|
|
+.PHONY: gnu
|
|
|
+gnu:
|
|
|
+ $(MAKE) gnu.src
|
|
|
+ $(MAKE) gnu.bin
|
|
|
+
|
|
|
+.PHONY: gnu.bin
|
|
|
+gnu.bin: gnu.riscv.build.stamp gnu.z80.build.stamp
|
|
|
|
|
|
# Note: the riscv-gnu-toolchain repo has bugs when building in
|
|
|
# parallel, so spoon feed it a sequence to avoid dependency problems.
|
|
|
+%.build.stamp:
|
|
|
+ $(MAKE) $*.build
|
|
|
+
|
|
|
.PHONY: gnu.riscv.build
|
|
|
-gnu.riscv.build: src
|
|
|
+gnu.riscv.build:
|
|
|
mkdir -p $@
|
|
|
cd $@ && $(riscv_configargs) ../$(tooldir)/configure $(riscv_config)
|
|
|
$(RMAKE) -C $@ $(riscv_configargs) build-binutils
|
|
|
$(RMAKE) -C $@ $(riscv_configargs) newlib
|
|
|
+ : >$@.stamp
|
|
|
|
|
|
.PHONY: gnu.z80.build
|
|
|
-gnu.z80.build: src
|
|
|
+gnu.z80.build:
|
|
|
mkdir -p $@
|
|
|
cd $@ && ../$(binutils)/configure $(z80_config)
|
|
|
$(RMAKE) -C $@
|
|
|
$(RMAKE) -C $@ install
|
|
|
+ : >$@.stamp
|