瀏覽代碼

Refactor; re-use code to run GRASS commands during build

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39163 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 15 年之前
父節點
當前提交
68c1443fef
共有 3 個文件被更改,包括 19 次插入23 次删除
  1. 1 14
      include/Make/Html.make
  2. 15 0
      include/Make/Rules.make
  3. 3 9
      include/Make/ScriptRules.make

+ 1 - 14
include/Make/Html.make

@@ -7,20 +7,7 @@ html:
 
 else
 
-htmldesc = \
-	GISRC=$(RUN_GISRC) \
-	GISBASE=$(RUN_GISBASE) \
-	PATH="$(GISBASE)/bin:$$PATH" \
-	PYTHONPATH="$(call mkpath,$(GISBASE)/etc/python,$$PYTHONPATH)" \
-	$(LD_LIBRARY_PATH_VAR)="$(BIN):$(ARCH_LIBDIR):$(BASE_LIBDIR):$($(LD_LIBRARY_PATH_VAR))" \
-	LC_ALL=C \
-	$(1) --html-description < /dev/null | grep -v '</body>\|</html>' > $(2)
-
-ifneq ($(MINGW),)
-mkpath = $(shell PATH="$(GISBASE)/bin:$(ARCH_LIBDIR):$$PATH" GISRC=$(RUN_GISRC) $(BIN)/g.dirseps$(EXE) -h $(1));$(2)
-else
-mkpath = $(1):$(2)
-endif
+htmldesc = $(call run_grass,$(1) --html-description < /dev/null | grep -v '</body>\|</html>' > $(2))
 
 $(HTMLDIR)/%.html: %.html %.tmp.html $(HTMLSRC)
 	-test -d $(HTMLDIR) || $(MKDIR) $(HTMLDIR)

+ 15 - 0
include/Make/Rules.make

@@ -21,6 +21,21 @@ $(OBJDIR):
 $(ARCH_INCDIR)/%.h: %.h
 	$(INSTALL_DATA) $< $@
 
+ifneq ($(MINGW),)
+mkpath = $(shell PATH="$(GISBASE)/bin:$(ARCH_LIBDIR):$$PATH" GISRC=$(RUN_GISRC) $(BIN)/g.dirseps$(EXE) -h $(1));$(2)
+else
+mkpath = $(1):$(2)
+endif
+
+run_grass = \
+	GISRC=$(RUN_GISRC) \
+	GISBASE=$(RUN_GISBASE) \
+	PATH="$(GISBASE)/bin:$$PATH" \
+	PYTHONPATH="$(call mkpath,$(GISBASE)/etc/python,$$PYTHONPATH)" \
+	$(LD_LIBRARY_PATH_VAR)="$(BIN):$(ARCH_LIBDIR):$(BASE_LIBDIR):$($(LD_LIBRARY_PATH_VAR))" \
+	LC_ALL=C \
+	$(1)
+
 # default clean rules
 clean:
 	-rm -rf $(OBJDIR) $(EXTRA_CLEAN_DIRS)

+ 3 - 9
include/Make/ScriptRules.make

@@ -15,16 +15,10 @@ $(SCRIPTDIR)/%.py: %.py
 # These are only the options (parser.c) type things.
 # See locale/scriptstrings/README for more information
 
-strings = \
-	GISRC=$(RUN_GISRC) \
-	GISBASE=$(RUN_GISBASE) \
-	PATH=$(BIN):$$PATH \
-	$(LD_LIBRARY_PATH_VAR)="$(ARCH_LIBDIR):$($(LD_LIBRARY_PATH_VAR))" \
-	g.parser -t $(1) | sed s/\"/\\\\\"/g | sed 's/.*/_("&")/' > \
-	$(2) ; true
+strings = $(call run_grass,g.parser -t $(1) | sed s/\"/\\\\\"/g | sed 's/.*/_("&")/' > $(2))
 
 $(STRINGDIR)/%_to_translate.c: %.py
-	$(call strings,$<,$@)
+	-$(call strings,$<,$@)
 
 $(STRINGDIR)/%_to_translate.c: %
-	$(call strings,$<,$@)
+	-$(call strings,$<,$@)