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

Index: foundry-0.0.20100226/tree/Makefile
===================================================================
--- foundry-0.0.20100226.orig/tree/Makefile	2013-06-14 22:21:42.000000000 +0200
+++ foundry-0.0.20100226/tree/Makefile	2013-06-14 22:34:59.649737162 +0200
@@ -1,7 +1,9 @@
 CXX = g++
 LEX = flex
 YACC = bison
+INSTALL = install
 
+CPPFLAGS ?=
 CXXFLAGS ?= -g -Wall -W -Werror
 LDFLAGS ?= -g -Wall -W -Werror
 
@@ -13,6 +15,10 @@
 OBJECTS = $(CXXSOURCES:%.cpp=%.o) $(LEXSOURCES:%.ll=%_lex.o) $(YACCSOURCES:%.yy=%_parse.o) $(YACCSOURCES:%.yy=%_tree.o)
 DEPFILES = $(addprefix stage1/,$(OBJECTS:%.o=.%.d)) $(addprefix stage2/,$(OBJECTS:%.o=.%.d))
 
+install: foundry-tree
+	$(INSTALL) -d $(DESTDIR)/usr/bin
+	$(INSTALL) $< $(DESTDIR)/usr/bin/
+
 all: foundry-tree \
     tree_tree.hpp-stamp tree_tree.cpp-stamp \
     tree_bison_tree.hpp-stamp tree_bison_tree.cpp-stamp \
@@ -73,22 +79,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)
@@ -103,6 +109,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:
