summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-01-24 11:03:20 +0800
committerChia-I Wu <[email protected]>2010-01-24 20:15:25 +0800
commit7be4d6b5f7ee8ccf8a5dfc117b348c2a165d4054 (patch)
tree15fe4b2486d02527c694ee323c6f4ce5df85c547
parente9bb06441eb4a50e9927dcc09289ec63b0e2cf0a (diff)
mesa/es: Improve Makefile rules.
Make sure glapi headers are cleaned when "make clean". Make sure all sources depend on subdirs-stamp-tmp so that sources/headers are generated first. subdirs-stamp-tmp will be removed after a successful build. It might be a problem when a build fails. But it is much better than where we currently are: glapi headers are never cleaned or re-generated.
-rw-r--r--src/mesa/es/Makefile32
-rw-r--r--src/mesa/es/glapi/Makefile6
2 files changed, 20 insertions, 18 deletions
diff --git a/src/mesa/es/Makefile b/src/mesa/es/Makefile
index ca38dc4aed0..fbe67445c93 100644
--- a/src/mesa/es/Makefile
+++ b/src/mesa/es/Makefile
@@ -10,12 +10,14 @@ ES1_LIBS := libes1gallium.a libes1api.a
ES2_LIBS := libes2gallium.a libes2api.a
# Default rule: create ES1 and ES2 libs
-.PHONY: default
-default: subdirs depend es1 es2
+.PHONY: default es1 es2
+default: depend es1 es2
es1: $(ES1_LIBS)
+ @rm -f subdirs-stamp-tmp
es2: $(ES2_LIBS)
+ @rm -f subdirs-stamp-tmp
# force the inclusion of es's mfeatures.h
ES1_CPPFLAGS := -include main/mfeatures_es1.h -D__GL_EXPORTS
@@ -104,24 +106,26 @@ clean:
-rm -f $(ES1_LIBS) $(ES2_LIBS)
-rm -rf $(ES1_OBJ_DIR) $(ES2_OBJ_DIR)
-rm -f $(GENERATED_SOURCES)
- -rm -f depend
- -rm -f *~
+ -rm -f depend depend.bak
+ -rm -f subdirs-stamp-tmp
+ @$(MAKE) -C glapi clean
# nothing to install
install:
-glapi/glapi-stamp:
- $(MAKE) -C glapi
+subdirs-stamp-tmp:
+ @$(MAKE) -C $(MESA) asm_subdirs
+ @$(MAKE) -C $(MESA) glsl_builtin
+ @$(MAKE) -C glapi
+ @touch subdirs-stamp-tmp
-subdirs: glapi/glapi-stamp
- $(MAKE) -C $(MESA) asm_subdirs
- $(MAKE) -C $(MESA) glsl_builtin
+# sort to avoid duplicates
+ALL_SOURCES := $(sort $(ES1_ALL_SOURCES) $(ES2_ALL_SOURCES))
-# remove generated sources because "depend" is checked even when "make clean"
-DEPEND_SOURCES := $(filter-out $(GENERATED_SOURCES), $(ES1_ALL_SOURCES) $(ES2_ALL_SOURCES))
-DEPEND_SOURCES := $(filter-out glapi/%, $(DEPEND_SOURCES))
+# need to make sure the subdirs are processed first
+$(ALL_SOURCES): | subdirs-stamp-tmp
-depend: glapi/glapi-stamp $(DEPEND_SOURCES)
+depend: $(ALL_SOURCES)
@echo "running $(MKDEP)"
@touch depend
@# MESA is "..", but luckily, directories are longer than 2 characters
@@ -132,4 +136,6 @@ depend: glapi/glapi-stamp $(DEPEND_SOURCES)
$(ES2_INCLUDES) $(ES2_ALL_SOURCES) 2>/dev/null | \
sed -e 's,^$(ES2_OBJ_DIR)/$(MESA)/,$(ES2_OBJ_DIR)/,' >> depend
+ifneq ($(MAKECMDGOALS),clean)
-include depend
+endif
diff --git a/src/mesa/es/glapi/Makefile b/src/mesa/es/glapi/Makefile
index 1256be953d1..1e32af867d5 100644
--- a/src/mesa/es/glapi/Makefile
+++ b/src/mesa/es/glapi/Makefile
@@ -30,10 +30,7 @@ ES2_DEPS = $(ES2_APIXML) base2_API.xml es2_EXT.xml es_EXT.xml \
ES1_OUTPUTS := $(addprefix $(ES1_OUTPUT_DIR)/, $(OUTPUTS))
ES2_OUTPUTS := $(addprefix $(ES2_OUTPUT_DIR)/, $(OUTPUTS))
-all: glapi-stamp
-
-glapi-stamp: $(ES1_OUTPUTS) $(ES2_OUTPUTS)
- @touch glapi-stamp
+all: $(ES1_OUTPUTS) $(ES2_OUTPUTS)
$(ES1_OUTPUTS): APIXML := $(ES1_APIXML)
$(ES2_OUTPUTS): APIXML := $(ES2_APIXML)
@@ -89,6 +86,5 @@ verify_xml:
@rm -f tmp.xml
clean:
- -rm -f glapi-stamp
-rm -rf $(ES1_OUTPUT_DIR) $(ES2_OUTPUT_DIR)
-rm -f *~ *.pyc *.pyo