Description: Support distclean target
Author: Simon Richter <sjr@debian.org>
Last-Update: 2013-06-14

Index: foundry-0.0.20130703/tree/Makefile
===================================================================
--- foundry-0.0.20130703.orig/tree/Makefile	2013-07-03 15:12:01.614425450 +0200
+++ foundry-0.0.20130703/tree/Makefile	2013-07-03 15:12:29.570424204 +0200
@@ -1,7 +1,9 @@
 CXX = g++
 LEX = flex
 YACC = bison
+INSTALL = install
 
+CPPFLAGS ?=
 CXXFLAGS ?= -g -Wall -W -Werror
 LDFLAGS ?= -g -Wall -W -Werror
 
@@ -17,9 +19,13 @@
 
 all: foundry-tree
 
-check: $(addprefix update/,$(BOOTSTRAP))
+test check: $(addprefix update/,$(BOOTSTRAP))
 
-.PHONY: update
+.PHONY: update test check
+
+install: foundry-tree
+	$(INSTALL) -d $(DESTDIR)/usr/bin
+	$(INSTALL) $< $(DESTDIR)/usr/bin/
 
 update: $(addprefix update/,$(BOOTSTRAP))
 	@for i in $(BOOTSTRAP); do \
@@ -86,22 +92,22 @@
 STAGE2_BUILT_HEADERS = $(YACCSOURCES:%.yy=%_parse.hpp) $(addprefix stage2/,$(YACCSOURCES:%.yy=%_tree.hpp)) $(LEXSOURCES:%.ll=%_lex.hpp) $(addprefix stage2/,$(TREESOURCES:%.ftree=%_tree.hpp))
 
 stage1/%.o: %.cpp
-	$(CXX) $(CXXFLAGS) -I. -o $@ -MD -MF stage1/.$*.d -c $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -I. -o $@ -MD -MF stage1/.$*.d -c $<
 
 stage2/%.o: %.cpp
-	$(CXX) $(CXXFLAGS) -Istage2 -I. -o $@ -MD -MF stage2/.$*.d -c $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Istage2 -I. -o $@ -MD -MF stage2/.$*.d -c $<
 
 stage2/tree_tree.o: stage2/tree_tree.cpp
-	$(CXX) $(CXXFLAGS) -Istage2 -I. -o $@ -MD -MF stage2/.$*.d -c $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Istage2 -I. -o $@ -MD -MF stage2/.$*.d -c $<
 
 stage2/tree_bison_tree.o: stage2/tree_bison_tree.cpp
-	$(CXX) $(CXXFLAGS) -Istage2 -I. -o $@ -MD -MF stage2/.$*.d -c $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Istage2 -I. -o $@ -MD -MF stage2/.$*.d -c $<
 
 stage2/tree_cst_tree.o: stage2/tree_cst_tree.cpp
-	$(CXX) $(CXXFLAGS) -Istage2 -I. -o $@ -MD -MF stage2/.$*.d -c $<
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Istage2 -I. -o $@ -MD -MF stage2/.$*.d -c $<
 
-stage1/tree_bison_lex.o stage2/tree_bison_lex.o: CXXFLAGS+=-Wno-unused-parameter
-stage1/tree_cst_lex.o stage2/tree_cst_lex.o: CXXFLAGS+=-Wno-unused-parameter
+stage1/tree_bison_lex.o stage2/tree_bison_lex.o: override CXXFLAGS+=-Wno-unused-parameter
+stage1/tree_cst_lex.o stage2/tree_cst_lex.o: override CXXFLAGS+=-Wno-unused-parameter
 
 stage1/.%.d:
 	@mkdir -p $(@D)
@@ -116,6 +122,12 @@
 	$(RM) foundry-tree
 	$(RM) -r update stage2 stage1
 
+distclean: clean
+	$(RM) tree_bison_lex.hpp tree_bison_parse.hpp
+	$(RM) tree_cst_lex.hpp tree_cst_parse.hpp
+
+test:
+
 sinclude $(DEPFILES)
 
 .SUFFIXES:
Index: foundry-0.0.20130703/parse/Makefile
===================================================================
--- foundry-0.0.20130703.orig/parse/Makefile	2013-07-03 15:12:23.846424459 +0200
+++ foundry-0.0.20130703/parse/Makefile	2013-07-03 15:12:29.570424204 +0200
@@ -1,9 +1,10 @@
 CXX ?= g++
+INSTALL ?= install
 CPPFLAGS ?=
 CXXFLAGS ?= -W -Wall -Werror -g
 LDFLAGS ?= -W -Wall -Werror -g
 
-CXXFLAGS += -std=c++0x
+override CXXFLAGS += -std=c++0x
 
 MKDIR ?= mkdir -p
 
@@ -19,10 +20,16 @@
 
 all: foundry-parse
 
+install: foundry-parse
+	$(INSTALL) -d $(DESTDIR)/usr/bin
+	$(INSTALL) $< $(DESTDIR)/usr/bin/
+
 foundry-parse: $(addprefix stage2/,$(OBJECTS))
 	$(CXX) $(LDFLAGS) -o $@ $^
 
-check: parse.yy.update parse.ll.update
+test check: parse.yy.update parse.ll.update
+
+.PHONY: update test check
 
 update: parse.yy.update parse.ll.update
 	cmp -s parse.ll.update parse.ll || cp parse.ll.update parse.ll
@@ -42,6 +49,8 @@
 	$(RM) -r stage2
 	$(RM) *.update
 
+distclean: clean
+
 stage1/foundry-parse: $(addprefix stage1/,$(OBJECTS))
 	$(CXX) $(LDFLAGS) -o $@ $^
 
