Sfoglia il codice sorgente

Allow creation of dependency files

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40667 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 15 anni fa
parent
commit
e44f467f39
4 ha cambiato i file con 20 aggiunte e 6 eliminazioni
  1. 8 1
      include/Make/Compile.make
  2. 6 4
      include/Make/Dir.make
  3. 2 0
      include/Make/Grass.make
  4. 4 1
      include/Make/Rules.make

+ 8 - 1
include/Make/Compile.make

@@ -9,7 +9,9 @@ linker_c = $(call linker_x,$(CC))
 linker_cxx = $(call linker_x,$(CXX))
 linker = $(call linker_x,$(LINK))
 
-compiler_x = $(1) $(2) $(LFS_CFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(DEFS) $(EXTRA_INC) $(INC) -o $@ -c $<
+ALL_CFLAGS = $(LFS_CFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(DEFS) $(EXTRA_INC) $(INC)
+
+compiler_x = $(1) $(2) $(ALL_CFLAGS) -o $@ -c $<
 compiler_c = $(call compiler_x,$(CC),$(COMPILE_FLAGS_C) $($*_c_FLAGS))
 compiler_cxx = $(call compiler_x,$(CXX),$(COMPILE_FLAGS_CXX) $($*_cc_FLAGS) $($*_cpp_FLAGS) $($*_cxx_FLAGS))
 compiler = $(call compiler_x,$(CC))
@@ -30,3 +32,8 @@ $(OBJDIR)/%.o : %.cpp $(LOCAL_HEADERS) $(EXTRA_HEADERS) | $(OBJDIR)
 
 %.output %.tab.h %.tab.c: %.y
 	$(YACC) -b$* $(YFLAGS) $<
+
+depend: $(C_SOURCES) $(CC_SOURCES) $(CPP_SOURCES)
+	-$(CC) -E -MM -MG $(ALL_CFLAGS) $^ | sed 's!^[0-9a-zA-Z_.-]*\.o:!$$(OBJDIR)/&!' > $(DEPFILE)
+
+-include $(DEPFILE)

+ 6 - 4
include/Make/Dir.make

@@ -15,17 +15,19 @@ subdirs:
 	    $(MAKE) -C $$subdir || echo $(CURDIR)/$$subdir >> $(ERRORLOG) ; \
 	done
 
-cleansubdirs:
+%-recursive:
 	@list='$(SUBDIRS)'; \
 	for subdir in $$list; do \
-	    $(MAKE) -C $$subdir clean; \
+	    $(MAKE) -C $$subdir $*; \
 	done
 
-clean: cleansubdirs
+clean: clean-recursive
+
+depend: depend-recursive
 
 htmldir: html
 
-.PHONY: subdirs cleansubdirs parsubdirs htmldir $(SUBDIRS)
+.PHONY: subdirs parsubdirs htmldir $(SUBDIRS)
 
 parsubdirs: $(SUBDIRS)
 

+ 2 - 0
include/Make/Grass.make

@@ -100,6 +100,8 @@ HTML2MAN = VERSION_NUMBER=$(GRASS_VERSION_NUMBER) $(GISBASE)/tools/g.html2man.py
 GDAL_LINK = $(USE_GDAL)
 GDAL_DYNAMIC = 1
 
+DEPFILE = depend.mk
+
 ##################### library switches ##################################
 
 libs = \

+ 4 - 1
include/Make/Rules.make

@@ -39,7 +39,7 @@ run_grass = \
 # default clean rules
 clean:
 	-rm -rf $(OBJDIR) $(EXTRA_CLEAN_DIRS)
-	-rm -f $(EXTRA_CLEAN_FILES) *.tab.[ch] *.yy.c *.output *.backup *.tmp.html *.pyc
+	-rm -f $(EXTRA_CLEAN_FILES) *.tab.[ch] *.yy.c *.output *.backup *.tmp.html *.pyc $(DEPFILE)
 	-if [ "$(CLEAN_SUBDIRS)" != "" ] ; then \
 		list='$(CLEAN_SUBDIRS)' ; \
 		for dir in $$list ; do \
@@ -47,3 +47,6 @@ clean:
 		done ; \
 	fi
 
+depend:
+
+.PHONY: clean depend