diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2009100871..436b76a69b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,40 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-01-30 20:19 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/make_gcc.mak + ! added additional rules to fix time conditions in parallel compilation + + * harbour/config/dos/dir.cf + * harbour/config/w32/dir.cf + * changed simple assignments to recursive ones + + * harbour/config/dir.cf + + added support for dependencies between build directories for + parallel execution. If compilation of dirX needs results of + dirY and dirZ compilation then it hsould be declared as: + dirX{dirY,dirZ} + % process directories defined in DIRS simultaneously when -j + GNU make switch is used - it gives additional speed improvement + on multi CPU machines + + * harbour/Makefile + * harbour/source/Makefile + * set directory dependencies for parallel compilation + + The parallel compilation can be enabled by using -j GNU make + switch on multiprocess platforms, f.e.: + ./gnu_make.sh -j3 + It should give some speed improvement even on single CPU machines. + These are results of clean Harbour compilation on my 3 phantom CPU + computer: + + 1. leaner compilation without -j 6m29.895s + 2. parallel compilation with -j5 but without + parallel directory processing 3m20.163s + 3. parallel compilation with -j5 and with new + parallel directory processing 2m6.168s + 2009-01-30 08:52 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * ChangeLog ! Typos in former ChangeLog entries. diff --git a/harbour/Makefile b/harbour/Makefile index fa3bf6e0fd..fb190eac9c 100644 --- a/harbour/Makefile +++ b/harbour/Makefile @@ -14,7 +14,7 @@ else ifeq ($(HB_HOST_BUILD),lib) HB_UTIL_DIR= else -HB_UTIL_DIR=utils +HB_UTIL_DIR=utils{source} endif DIRS=\ @@ -22,7 +22,7 @@ DIRS=\ include \ source \ $(HB_UTIL_DIR) \ - contrib \ + contrib{source} \ endif diff --git a/harbour/config/dir.cf b/harbour/config/dir.cf index d87529252d..d66f014490 100644 --- a/harbour/config/dir.cf +++ b/harbour/config/dir.cf @@ -9,6 +9,7 @@ include $(TOP)$(ROOT)config/global.cf #include $(TOP)$(ROOT)config/$(HB_ARCHITECTURE)/dir.cf ifeq ($(DIR_RULE),) + # NOTE: The empty line directly before 'endef' HAVE TO exist! # It causes that every commands will be separated by LF define dir_mk @@ -16,15 +17,56 @@ $(MK) -C $(dir) $@ endef -DIRS_MK = $(foreach d, $(DIRS), $(if $(wildcard $(d)/Makefile),$(d),)) +DIRS_PURE = $(filter-out {%},$(subst {, {,$(DIRS))) +DIRS_DEP = $(filter-out $(DIRS_PURE),$(DIRS)) +DIRS_MK = $(foreach d, $(DIRS_PURE), $(if $(wildcard $(d)/Makefile),$(d),)) DIR_RULE = $(foreach dir, $(DIRS_MK), $(dir_mk)) +MULTI_DEPS = yes + +else + +DIRS := $(filter-out {%},$(subst {, {,$(DIRS))) +MULTI_DEPS = no + endif all : first +ifneq ($(MULTI_DEPS),yes) + first clean install:: +$(DIR_RULE) +else + +DIRS_CLEAN = $(foreach dir, $(DIRS_MK), $(dir).clean) +DIRS_INST = $(foreach dir, $(DIRS_MK), $(dir).inst) + +first :: $(DIRS_MK) +install :: $(DIRS_INST) +clean :: $(DIRS_CLEAN) + +comma=, +define dep_rule +$(subst $(comma),$(2) ,$(subst },$(2),$(subst {,$(2)::|,$(1)))) +endef + +$(foreach dep, $(DIRS_DEP), $(eval $(call dep_rule,$(dep),.clean))) +$(foreach dep, $(DIRS_DEP), $(eval $(call dep_rule,$(dep),.inst))) +$(foreach dep, $(DIRS_DEP), $(eval $(call dep_rule,$(dep),))) + +$(DIRS_CLEAN) :: + +$(MK) -C $(@:.clean=) clean + +$(DIRS_INST) :: + +$(MK) -C $(@:.inst=) install + +$(DIRS_MK) :: + +$(MK) -C $(@) + +endif + + ifneq ($(HB_POSTINST),) install:: +$(HB_POSTINST) diff --git a/harbour/config/dos/dir.cf b/harbour/config/dos/dir.cf index 669603039f..71126cddc7 100644 --- a/harbour/config/dos/dir.cf +++ b/harbour/config/dos/dir.cf @@ -20,8 +20,8 @@ $(DIR_MAKE) -C $(file) $@ endef -DIR_LIST := $(subst /,\,$(DIRS)) -DIR_MAKE := $(subst /,\,$(MK)) +DIR_LIST = $(subst /,\,$(DIRS)) +DIR_MAKE = $(subst /,\,$(MK)) DIR_RULE = $(foreach file, $(DIR_LIST), $(dir_mk)) else # bash diff --git a/harbour/config/w32/dir.cf b/harbour/config/w32/dir.cf index d4792650cd..99b55beaf1 100644 --- a/harbour/config/w32/dir.cf +++ b/harbour/config/w32/dir.cf @@ -10,8 +10,8 @@ ifeq ($(DIRS),) # Empty directory list DIR_RULE =\ @echo Done else -DIR_LIST := $(subst /,\,$(DIRS)) -DIR_MAKE := $(subst /,\,$(MK)) +DIR_LIST = $(subst /,\,$(DIRS)) +DIR_MAKE = $(subst /,\,$(MK)) DIR_RULE =\ $(COMSPEC) /C FOR %d IN ($(DIR_LIST)) DO $(DIR_MAKE) -C %d $@ endif diff --git a/harbour/make_gcc.mak b/harbour/make_gcc.mak index ad2a7c317e..dd8c4cd01d 100644 --- a/harbour/make_gcc.mak +++ b/harbour/make_gcc.mak @@ -432,15 +432,15 @@ $(HBTEST_EXE) :: StdLibs $(HBTEST_EXE) :: $(HBTEST_EXE_OBJS) $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) #********************************************************** -$(HBI18N_EXE) :: MinLibs +$(HBI18N_EXE) :: StdLibs $(HBI18N_EXE) :: $(HBI18N_EXE_OBJS) $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) #********************************************************** -$(HBDOC_EXE) :: MinLibs +$(HBDOC_EXE) :: StdLibs $(HBDOC_EXE) :: $(HBDOC_EXE_OBJS) $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) #********************************************************** -$(HBMAKE_EXE) :: MinLibs +$(HBMAKE_EXE) :: StdLibs $(HBMAKE_EXE) :: $(HBMAKE_EXE_OBJS) $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) #********************************************************** @@ -484,13 +484,17 @@ $(DLL_OBJ_DIR)/pptable.c : $(HBPP) $(INCLUDE_DIR)/hbstdgen.ch $(INCLUDE_DIR)/std #********************************************************** +# additional dependencies for parallel execution +$(OBJ_DIR)/macrolex$(OBJEXT) : $(OBJ_DIR)/macroy.c +$(OBJ_DIR)/complex$(OBJEXT) : $(OBJ_DIR)/harboury.c + ifeq ("$(HB_REBUILD_PARSER)","yes") $(OBJ_DIR)/macroy.c : $(MACRO_DIR)/macro.y - bison --no-line -d $^ -o$@ + bison --no-line -d $< -o$@ $(OBJ_DIR)/harboury.c : $(COMPILER_DIR)/harbour.y - bison --no-line -d $^ -o$@ + bison --no-line -d $< -o$@ else @@ -507,23 +511,27 @@ endif #********************************************************** #$(OBJ_DIR)/macrol.c : $(MACRO_DIR)/macro.l -# flex -Phb_macro -i -8 -o$@ $^ +# flex -Phb_macro -i -8 -o$@ $< #$(OBJ_DIR)/harbourl.c : $(COMPILER_DIR)/harbour.l -# flex -Phb_comp -i -8 -o$@ $^ +# flex -Phb_comp -i -8 -o$@ $< #$(OBJ_DIR)/harbourl$(OBJEXT) : $(OBJ_DIR)/harbourl.c #$(OBJ_DIR)/macrol$(OBJEXT) : $(OBJ_DIR)/macrol.c #********************************************************** +# additional dependencies for parallel execution +$(DLL_OBJ_DIR)/macrolex$(OBJEXT) : $(DLL_OBJ_DIR)/macroy.c +$(DLL_OBJ_DIR)/complex$(OBJEXT) : $(DLL_OBJ_DIR)/harboury.c + ifeq ("$(HB_REBUILD_PARSER)","yes") $(DLL_OBJ_DIR)/macroy.c : $(MACRO_DIR)/macro.y - bison --no-line -d $^ -o$@ + bison --no-line -d $< -o$@ $(DLL_OBJ_DIR)/harboury.c : $(COMPILER_DIR)/harbour.y - bison --no-line -d $^ -o$@ + bison --no-line -d $< -o$@ else @@ -540,10 +548,10 @@ endif #********************************************************** #$(DLL_OBJ_DIR)/macrol.c : $(MACRO_DIR)/macro.l -# flex -Phb_macro -i -8 -o$@ $^ +# flex -Phb_macro -i -8 -o$@ $< #$(DLL_OBJ_DIR)/harbourl.c : $(COMPILER_DIR)/harbour.l -# flex -Phb_comp -i -8 -o$@ $^ +# flex -Phb_comp -i -8 -o$@ $< #$(DLL_OBJ_DIR)/harbourl$(OBJEXT) : $(DLL_OBJ_DIR)/harbourl.c #$(DLL_OBJ_DIR)/macrol$(OBJEXT) : $(DLL_OBJ_DIR)/macrol.c @@ -562,9 +570,7 @@ Clean: doClean CLEAN: doClean doClean: - -$(DEL) $(HB_BUILD_TARGETS) - -$(DEL) $(HB_DLL_IMPLIB) - -$(DEL) $(HB_DLL_IMPLIBMT) + -$(DEL) $(HB_BUILD_TARGETS) $(HB_DLL_IMPLIB) $(HB_DLL_IMPLIBMT) -$(DEL) $(OBJ_DIR)/*$(OBJEXT) -$(DEL) $(OBJ_DIR)/*.c -$(DEL) $(OBJ_DIR)/*.h diff --git a/harbour/source/Makefile b/harbour/source/Makefile index e8aaea29b3..e4f0a40ce6 100644 --- a/harbour/source/Makefile +++ b/harbour/source/Makefile @@ -8,33 +8,33 @@ ifeq ($(HB_HOST_BUILD),yes) DIRS=\ common \ - pp \ - compiler \ - main \ + pp{common} \ + compiler{pp} \ + main{compiler} \ else ifeq ($(HB_HOST_BUILD),lib) HB_COMP_DIR= else -HB_COMP_DIR=main +HB_COMP_DIR=main{compiler} endif DIRS=\ common \ - pp \ - compiler \ + pp{common} \ + compiler{pp} \ $(HB_COMP_DIR) \ - rtl \ - vm \ + rtl{main} \ + vm{main} \ macro \ codepage \ lang \ - rdd \ - hbextern \ + rdd{main} \ + hbextern{main} \ hbpcre \ hbzlib \ - debug \ + debug{main} \ endif