![]() | |||||||||||||
Messages in this thread Patch in this message |
This patch improves the makefiles by making all subdirectories separate targets that can be built in parallel. Additionally make -k works better because the build process is not just aborted if an error occurs in one directory, instead it continues to build the other directories. Please tell me what you think about this. Now if you have *very* much memory to waste you might want to try `make -j'. :-) --- linux-2.1.81/Makefile.~1~ Mon Jan 26 17:33:16 1998 +++ linux-2.1.81/Makefile Tue Jan 27 00:29:10 1998 @@ -227,8 +227,14 @@ $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in scripts/split-include include/linux/autoconf.h include/config -linuxsubdirs: dummy - set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done +.PHONY: linuxsubdirs +linuxsubdirs: $(SUBDIRS) + +ifdef SUBDIRS +.PHONY: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ +endif $(TOPDIR)/include/linux/version.h: include/linux/version.h $(TOPDIR)/include/linux/compile.h: include/linux/compile.h @@ -270,38 +276,19 @@ init/main.o: init/main.c $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $< -fs: dummy - $(MAKE) linuxsubdirs SUBDIRS=fs - -lib: dummy - $(MAKE) linuxsubdirs SUBDIRS=lib - -mm: dummy - $(MAKE) linuxsubdirs SUBDIRS=mm - -ipc: dummy - $(MAKE) linuxsubdirs SUBDIRS=ipc - -kernel: dummy - $(MAKE) linuxsubdirs SUBDIRS=kernel - -drivers: dummy - $(MAKE) linuxsubdirs SUBDIRS=drivers - -net: dummy - $(MAKE) linuxsubdirs SUBDIRS=net - MODFLAGS = -DMODULE ifdef CONFIG_MODULES ifdef CONFIG_MODVERSIONS MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h endif -modules: include/linux/version.h - @set -e; \ - for i in $(SUBDIRS); \ - do $(MAKE) -C $$i CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules; \ - done +modules: $(addsuffix _modules,$(SUBDIRS)) + +ifdef SUBDIRS +.PHONY: $(addsuffix _modules,$(SUBDIRS)) +$(addsuffix _modules,$(SUBDIRS)): %_modules: include/linux/version.h + $(MAKE) -C $* CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules +endif modules_install: @( \ @@ -324,7 +311,7 @@ if [ -f HAM_MODULES ]; then inst_mod HAM_MODULES net; fi; \ \ ls *.o > .allmods; \ - echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \ + ls $$MODULES | comm -23 .allmods - > .misc; \ if [ -s .misc ]; then inst_mod .misc misc; fi; \ rm -f .misc .allmods; \ ) --- linux-2.1.81/Rules.make.~1~ Wed Jan 21 18:22:26 1998 +++ linux-2.1.81/Rules.make Tue Jan 27 00:38:07 1998 @@ -111,9 +111,14 @@ # # A rule to make subdirectories # -sub_dirs: dummy -ifdef SUB_DIRS - set -e; for i in $(SUB_DIRS); do $(MAKE) -C $$i; done +sub_dirs: $(SUB_DIRS) + +ifdef ALL_SUB_DIRS +.PHONY: $(ALL_SUB_DIRS) $(addsuffix _modules,$(ALL_SUB_DIRS)) +$(ALL_SUB_DIRS): + $(MAKE) -C $@ +$(addsuffix _modules,$(ALL_SUB_DIRS)): %_modules: + $(MAKE) -C $* modules endif # @@ -123,30 +128,23 @@ ifneq "$(strip $(ALL_MOBJS))" "" PDWN=$(shell $(CONFIG_SHELL) $(TOPDIR)/scripts/pathdown.sh) endif -modules: $(ALL_MOBJS) $(MIX_OBJS) $(MI_OBJS) dummy -ifdef MOD_SUB_DIRS - set -e; for i in $(MOD_SUB_DIRS); do $(MAKE) -C $$i modules; done -endif -ifdef MOD_IN_SUB_DIRS - set -e; for i in $(MOD_IN_SUB_DIRS); do $(MAKE) -C $$i modules; done -endif +.PHONY: modules +modules: $(ALL_MOBJS) $(MIX_OBJS) $(MI_OBJS) \ + $(addsuffix _modules,$(MOD_SUB_DIRS) $(MOD_IN_SUB_DIRS)) ifneq "$(strip $(MOD_LIST_NAME))" "" - rm -f $$TOPDIR/modules/$(MOD_LIST_NAME) + rm -f $(TOPDIR)/modules/$(MOD_LIST_NAME) ifdef MOD_SUB_DIRS - for i in $(MOD_SUB_DIRS); do \ - echo `basename $$i`.o >> $$TOPDIR/modules/$(MOD_LIST_NAME); done + echo $(addsuffix .o,$(notdir $(MOD_SUB_DIRS))) >> $(TOPDIR)/modules/$(MOD_LIST_NAME) endif ifneq "$(strip $(ALL_MOBJS))" "" - echo $(ALL_MOBJS) >> $$TOPDIR/modules/$(MOD_LIST_NAME) + echo $(ALL_MOBJS) >> $(TOPDIR)/modules/$(MOD_LIST_NAME) endif ifneq "$(strip $(MOD_TO_LIST))" "" - echo $(MOD_TO_LIST) >> $$TOPDIR/modules/$(MOD_LIST_NAME) + echo $(MOD_TO_LIST) >> $(TOPDIR)/modules/$(MOD_LIST_NAME) endif endif ifneq "$(strip $(ALL_MOBJS))" "" - echo $(PDWN) - cd $$TOPDIR/modules; for i in $(ALL_MOBJS); do \ - ln -sf ../$(PDWN)/$$i $$i; done + ln -sf $(addprefix ../$(PDWN),$(ALL_MOBJS)) $(TOPDIR)/modules endif # @@ -212,7 +210,7 @@ endif # CONFIG_MODVERSIONS ifneq "$(strip $(SYMTAB_OBJS))" "" -$(SYMTAB_OBJS): $(TOPDIR)/include/linux/modversions.h $(SYMTAB_OBJS:.o=.c) +$(SYMTAB_OBJS): $(TOPDIR)/include/linux/modversions.h $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c) @ ( \ echo 'ifeq ($(strip $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB),$$(strip $$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@) -DEXPORT_SYMTAB))' ; \ -- Andreas Schwab "And now for something schwab@issan.informatik.uni-dortmund.de completely different" schwab@gnu.org | ||||||||||||
| Last update: 2005-03-22 12:41 [W:0.123 / U:0.100 seconds] ©2003-2008 Jasper Spaans | |||||||||||||