Permalink
Browse files

Cut down global compilation time, see details:

- When running multiple makefiles' install target, you should NEVER
  EVER depend on the plain 'all' target!!!! 'install' already depends
  on 'all' inside each makefile. Failure to abide by this can
  unnecessarily multiply the number of times makefiles are called.
  Previously the unixtool makefiles were being processed EIGHT times!
- The apps folder now has its own userlibs-like makefile
- The unixtools makefile has been replaced with a userlibs-like one
  • Loading branch information...
1 parent e58d45d commit 051ad7a219ebd5f3caace99f1b959f4d949d9ecd @fincs committed Aug 18, 2012
Showing with 31 additions and 32 deletions.
  1. +14 −20 Makefile
  2. +13 −8 apps/unixtools/Makefile
  3. +4 −4 sdk/userlib/Makefile
View
@@ -1,6 +1,3 @@
-SUBDIRS := $(patsubst %/,%,$(dir $(wildcard */Makefile)))
-APPS := $(patsubst %/,%,$(dir $(wildcard apps/*/Makefile)))
-
ifeq ($(FEOSDEST),)
export FEOSDEST = $(FEOSSDK)/../FeOS
endif
@@ -17,22 +14,24 @@ endif
sdk sdkclean sdkinstall\
lib libclean libinstall\
apps appsclean appsinstall\
- $(APPS)
+ outputfolders
################################################################################
# generic rules
################################################################################
all: $(ALL)
- @mkdir -p $(FEOSDEST)/data/FeOS/bin
- @mkdir -p $(FEOSDEST)/data/FeOS/lib
- @mkdir -p $(FEOSDEST)/data/FeOS/arm7
clean: $(addsuffix clean,$(ALL))
@rm -f $(FEOSDEST)/data/FeOS/bin/*
@rm -f $(FEOSDEST)/data/FeOS/lib/*
@rm -f $(FEOSDEST)/data/FeOS/arm7/*
-install: all $(addsuffix install,$(ALL))
+install: $(addsuffix install,$(ALL))
+
+outputfolders:
+ @mkdir -p $(FEOSDEST)/data/FeOS/bin
+ @mkdir -p $(FEOSDEST)/data/FeOS/lib
+ @mkdir -p $(FEOSDEST)/data/FeOS/arm7
################################################################################
# 'all' rules
@@ -46,10 +45,8 @@ sdk:
lib: sdk
@$(MAKE) --no-print-directory -C sdk/userlib
-apps: lib $(APPS)
-
-$(APPS): lib
- @$(MAKE) --no-print-directory -C $@
+apps: lib
+ @$(MAKE) --no-print-directory -C apps
################################################################################
# 'clean' rules
@@ -64,22 +61,19 @@ libclean:
@$(MAKE) --no-print-directory -C sdk/userlib clean
appsclean:
- @for i in $(APPS); do $(MAKE) --no-print-directory -C $$i clean; done
+ @$(MAKE) --no-print-directory -C apps clean
################################################################################
# 'install' rules
################################################################################
-sdkinstall: sdk
+sdkinstall: sdk outputfolders
@cp kernel/FeOS.nds $(FEOSDEST)/FeOS.nds
@cp kernel/FeOSd.nds $(FEOSDEST)/FeOSd.nds
@cp sdk/feoscxx.fx2 $(FEOSDEST)/data/FeOS/lib/feoscxx.fx2
@[ -e $(AUTOEXEC) ] || touch $(AUTOEXEC)
-libinstall: lib
- @mkdir -p $(FEOSDEST)/data/FeOS/bin
- @mkdir -p $(FEOSDEST)/data/FeOS/lib
- @mkdir -p $(FEOSDEST)/data/FeOS/arm7
+libinstall: outputfolders
@$(MAKE) --no-print-directory -C sdk/userlib install
-appsinstall: apps
- @for i in $(APPS); do $(MAKE) --no-print-directory -C $$i install; done
+appsinstall: libinstall
+ @$(MAKE) --no-print-directory -C apps install
View
@@ -1,13 +1,18 @@
-SUBDIRS := $(patsubst %/,%,$(dir $(wildcard */Makefile)))
-.PHONY: $(SUBDIRS)
+APPS := $(patsubst %/,%,$(dir $(wildcard */Makefile)))
-all: $(SUBDIRS)
+ifeq ($(FEOSDEST),)
+export FEOSDEST = $(FEOSSDK)/../FeOS
+endif
-clean:
- @for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done
+.PHONY: all clean install $(APPS)
+all: $(APPS)
+
+clean: TARGET := clean
+clean: all
+
+install: TARGET := install
install: all
- @for i in $(SUBDIRS); do $(MAKE) -C $$i install; done
-$(SUBDIRS):
- $(MAKE) -C $@
+$(APPS):
+ @$(MAKE) --no-print-directory -C $@ $(TARGET)
View
@@ -9,13 +9,13 @@ endif
all: $(USERLIBS)
-clean:
- @for i in $(USERLIBS); do $(MAKE) --no-print-directory -C $$i clean; done
+clean: TARGET := clean
+clean: all
+install: TARGET := install
install: all
- @for i in $(USERLIBS); do $(MAKE) --no-print-directory -C $$i install; done
$(USERLIBS):
- @$(MAKE) --no-print-directory -C $@
+ @$(MAKE) --no-print-directory -C $@ $(TARGET)
-include $(DEPENDS)

0 comments on commit 051ad7a

Please sign in to comment.