From: Philipp Hachtmann Date: Sat, 18 Jan 2014 16:07:31 +0000 (+0100) Subject: global: Makefiles now support parallel compiles. X-Git-Url: http://gitweb.hachti.de/?a=commitdiff_plain;h=4ad624fd6d8bf4db02fe531b51f363ba9d89707e;p=h316.git global: Makefiles now support parallel compiles. Signed-off-by: Philipp Hachtmann --- diff --git a/.gitignore b/.gitignore index 2d112bb..2a3b040 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.dep .* h316rc +bin/h316 !.empty !.gitignore !obj \ No newline at end of file diff --git a/Makefile b/Makefile index cb4c049..f7f397e 100644 --- a/Makefile +++ b/Makefile @@ -20,13 +20,15 @@ SUBDIRS = pc-tools lib systems programs .done_systems: .done_programs_tools @$(MAKE) -C systems && touch $@ -.done_programs_fortran: .done_systems +.done_programs_fortran: .done_systems_dap @$(MAKE) -C programs/fortran && touch $@ .done_programs: .done_programs_fortran @$(MAKE) -C programs && touch $@ -default: .done_programs +.done_systems: .done_programs + +default: .done_systems clean: @$(foreach subdir, $(SUBDIRS), $(MAKE) -C $(subdir) $@&&) true diff --git a/lib/common/buildlib.sh b/lib/common/buildlib.sh index 75875a6..ae09483 100755 --- a/lib/common/buildlib.sh +++ b/lib/common/buildlib.sh @@ -21,7 +21,7 @@ clean() { make_org() { if [ ! -d "$ORG_OBJDIR" ]; then echo "Buildlib: Creating directory $ORG_OBJDIR." - mkdir $ORG_OBJDIR + mkdir -p $ORG_OBJDIR fi tdir=$PWD cd $ORG_OBJDIR @@ -33,7 +33,7 @@ make_org() { genlib(){ if [ ! -d "$LIB_DIR" ]; then echo -n "Creating $LIB_DIR:" - mkdir $LIB_DIR && echo "Ok." || echo "FAILED!" + mkdir -p $LIB_DIR && echo "Ok." || echo "FAILED!" fi recipe=$1 diff --git a/lib/fortran/Makefile b/lib/fortran/Makefile index d2c768c..4a0afaf 100644 --- a/lib/fortran/Makefile +++ b/lib/fortran/Makefile @@ -51,7 +51,7 @@ $(OBJECTS): $(OBJECT_FILES) $(OBJECT_FILES) : $(OBJ_DIR)/%.obj : $(SRC_DIR)/%.asm # @echo Building: $(subst $$,\$$,$@) - @if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi + @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi @ rm -f $@ @ cd $(OBJ_DIR) && $(ASM_COMMAND) ../$(subst $$,\$$,$^) $(LISTING) @ cd $(OBJ_DIR) && $(LDC_COMMAND) $(notdir $(subst $$,\$$,$@)) diff --git a/lib/hachti/Makefile b/lib/hachti/Makefile index d813e06..4a2cf53 100644 --- a/lib/hachti/Makefile +++ b/lib/hachti/Makefile @@ -47,7 +47,7 @@ all: $(LIBS) # @echo '$(F4_OBJECT_FILES)' $(ORG_OBJDIR)/lastrun: $(ORG_LIBDIR)/* - @if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi + @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi @./buildlib.sh makeorg $(OBJECTS): $(OBJECT_FILES) $(F4_OBJECT_FILES) @@ -55,7 +55,7 @@ $(OBJECTS): $(OBJECT_FILES) $(F4_OBJECT_FILES) $(OBJECT_FILES):$(OBJ_DIR)/%.obj : $(SRC_DIR)/%.asm @echo Building: $(subst $$,\$$,$@) - @if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi + @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi @ rm -f $@ @ cd $(OBJ_DIR) && $(ASM_COMMAND) ../$(subst $$,\$$,$^) $(LISTING) @ cd $(OBJ_DIR) && $(LDC_COMMAND) $(notdir $(subst $$,\$$,$@)) @@ -63,7 +63,7 @@ $(OBJECT_FILES):$(OBJ_DIR)/%.obj : $(SRC_DIR)/%.asm $(F4_OBJECT_FILES):$(OBJ_DIR)/%.obj : $(SRC_DIR)/%.f # @echo Building: $(subst $$,\$$,$@) - @if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi + @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi @ rm -f $@ @ cd $(OBJ_DIR) && $(FRTN_COMMAND) ../$(subst $$,\$$,$^) @ cd $(OBJ_DIR) && $(LDC_COMMAND) $(notdir $(subst $$,\$$,$@)) diff --git a/lib/iolib/Makefile b/lib/iolib/Makefile index 587fc2a..133ccd6 100644 --- a/lib/iolib/Makefile +++ b/lib/iolib/Makefile @@ -58,7 +58,7 @@ $(OBJECTS): $(OBJECT_FILES) $(OBJECT_FILES) : $(OBJ_DIR)/%.obj : $(SRC_DIR)/%.asm # @echo Building: $(subst $$,\$$,$@) - @if [ ! -d $(OBJ_DIR) ]; then mkdir $(OBJ_DIR); fi + @if [ ! -d $(OBJ_DIR) ]; then mkdir -p $(OBJ_DIR); fi @ rm -f $@ @ cd $(OBJ_DIR) && $(ASM_COMMAND) ../$(subst $$,\$$,$^) $(LISTING) @ cd $(OBJ_DIR) && $(LDC_COMMAND) $(notdir $(subst $$,\$$,$@)) diff --git a/programs/Makefile b/programs/Makefile index bf806aa..381de2f 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -2,6 +2,11 @@ MODULES=first-steps fortran mandelbrot plotter\ punchomat small-things tools libtest +.done_fortran: + @$(MAKE) -C fortran && touch $@ + +.done_tools: + @$(MAKE) -C tools && touch $@ %: @$(foreach mod,$(MODULES),$(MAKE) -C $(mod) $@ &&) true @@ -9,4 +14,9 @@ MODULES=first-steps fortran mandelbrot plotter\ katzelmutelbrummsilalla: @$(foreach mod,$(MODULES),$(MAKE) -C $(mod)&&) true -.PHONY:default \ No newline at end of file +clean: + @$(foreach mod,$(MODULES),$(MAKE) -C $(mod) $@ &&) true + rm -f .done_* + + +.PHONY:default clean \ No newline at end of file diff --git a/programs/first-steps/Makefile b/programs/first-steps/Makefile index 9720a05..81f0c3a 100644 --- a/programs/first-steps/Makefile +++ b/programs/first-steps/Makefile @@ -13,11 +13,11 @@ PROGRAMS=$(foreach n, $(wildcard $(SRC_DIR)/*.f $(SRC_DIR)/*.asm),$(notdir $(bas default: $(foreach prog, $(PROGRAMS),$(BUILD_DIR)/$(prog).obj) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.f - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi @$(FRTN_CMD) $< && mv $(notdir $(basename $<)).obj $(BUILD_DIR) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.asm - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi @$(ASM_CMD) $< && mv $(notdir $(basename $<)).obj $(BUILD_DIR) clean : diff --git a/programs/fortran/Makefile b/programs/fortran/Makefile index 6eaa150..7dfedf1 100644 --- a/programs/fortran/Makefile +++ b/programs/fortran/Makefile @@ -15,10 +15,10 @@ clean : .PHONY: default clean build/%.obj:src/%.f - @if [ ! -d build ]; then mkdir build; fi + @if [ ! -d build ]; then mkdir -p build; fi $(FRTN) '$^' mv '$(notdir $@)' build build/%.obj:src/%.asm - @if [ ! -d build ]; then mkdir build; fi + @if [ ! -d build ]; then mkdir -p build; fi @ $(ASM) '$^' && mv '$(notdir $@)' build diff --git a/programs/libtest/Makefile b/programs/libtest/Makefile index b905399..29c32be 100644 --- a/programs/libtest/Makefile +++ b/programs/libtest/Makefile @@ -11,11 +11,11 @@ PROGRAMS=$(foreach n, $(wildcard $(SRC_DIR)/*.f $(SRC_DIR)/*.asm),$(notdir $(bas default: $(foreach prog, $(PROGRAMS),$(BUILD_DIR)/$(prog).obj) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.f - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi $(FRTN_CMD) $< $(LISTING) && mv $(notdir $(basename $<)).obj $(BUILD_DIR) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.asm - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi $(ASM_CMD) $< $(LISTING)&& mv $(notdir $(basename $<)).obj $(BUILD_DIR) clean : diff --git a/programs/mandelbrot/Makefile b/programs/mandelbrot/Makefile index 52bf585..6b886be 100644 --- a/programs/mandelbrot/Makefile +++ b/programs/mandelbrot/Makefile @@ -12,11 +12,11 @@ PROGRAMS=$(foreach n, $(wildcard $(SRC_DIR)/*.f $(SRC_DIR)/*.asm),$(notdir $(bas default: $(foreach prog, $(PROGRAMS),$(BUILD_DIR)/$(prog).obj) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.f - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi @$(FRTN_CMD) $< && mv $(notdir $(basename $<)).obj $(BUILD_DIR) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.asm - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi @$(ASM_CMD) $< && mv $(notdir $(basename $<)).obj $(BUILD_DIR) clean : diff --git a/programs/plotter/Makefile b/programs/plotter/Makefile index 199adff..f9e0155 100644 --- a/programs/plotter/Makefile +++ b/programs/plotter/Makefile @@ -11,12 +11,12 @@ PROGRAMS=$(foreach n, $(wildcard $(SRC_DIR)/*.f $(SRC_DIR)/*.asm),$(notdir $(bas default: $(foreach prog, $(PROGRAMS),$(BUILD_DIR)/$(prog).obj) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.f - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi $(FRTN_CMD) $< $(LISTING) && mv $(notdir $(basename $<)).obj $(BUILD_DIR) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.asm - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi $(ASM_CMD) $< $(LISTING)&& mv $(notdir $(basename $<)).obj $(BUILD_DIR) diff --git a/programs/punchomat/Makefile b/programs/punchomat/Makefile index 686e7d1..ead349c 100644 --- a/programs/punchomat/Makefile +++ b/programs/punchomat/Makefile @@ -12,12 +12,12 @@ default: all all: $(foreach prog, $(PROGRAMS),$(BUILD_DIR)/$(prog).obj) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.f - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi @$(FRTN_CMD) "$(subst $$,\$$,$^)" &&\ mv "$(notdir $(basename $(subst $$,\$$,$^))).obj" $(BUILD_DIR) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.asm - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi @$(ASM_CMD) "$(subst $$,\$$,$^)" &&\ mv "$(notdir $(basename "\"$(subst $$,\$$,$^)\"")).obj" $(BUILD_DIR) diff --git a/programs/small-things/Makefile b/programs/small-things/Makefile index 686e7d1..ead349c 100644 --- a/programs/small-things/Makefile +++ b/programs/small-things/Makefile @@ -12,12 +12,12 @@ default: all all: $(foreach prog, $(PROGRAMS),$(BUILD_DIR)/$(prog).obj) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.f - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi @$(FRTN_CMD) "$(subst $$,\$$,$^)" &&\ mv "$(notdir $(basename $(subst $$,\$$,$^))).obj" $(BUILD_DIR) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.asm - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi @$(ASM_CMD) "$(subst $$,\$$,$^)" &&\ mv "$(notdir $(basename "\"$(subst $$,\$$,$^)\"")).obj" $(BUILD_DIR) diff --git a/programs/tools/Makefile b/programs/tools/Makefile index 686e7d1..ead349c 100644 --- a/programs/tools/Makefile +++ b/programs/tools/Makefile @@ -12,12 +12,12 @@ default: all all: $(foreach prog, $(PROGRAMS),$(BUILD_DIR)/$(prog).obj) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.f - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi @$(FRTN_CMD) "$(subst $$,\$$,$^)" &&\ mv "$(notdir $(basename $(subst $$,\$$,$^))).obj" $(BUILD_DIR) $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.asm - @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi + @if [ ! -d $(BUILD_DIR) ]; then mkdir -p $(BUILD_DIR); fi @$(ASM_CMD) "$(subst $$,\$$,$^)" &&\ mv "$(notdir $(basename "\"$(subst $$,\$$,$^)\"")).obj" $(BUILD_DIR)