added SUBDIRS to top-level Makefile to make adding subdirectories easier

git-svn-id: svn://anubis/fart/trunk@214 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2009-03-13 19:26:12 +00:00
parent 195593cc9b
commit f103b71ed6
2 changed files with 14 additions and 10 deletions

View File

@ -9,19 +9,23 @@ export CXXFLAGS := -Wall -O2
LDFLAGS := -lfl
SUBDIRS := util shapes main parser
all: $(TARGET)
.PHONY: $(TARGET)
$(TARGET):
make -C util
make -C shapes
make -C main
make -C parser
$(CXX) -o $@ main/*.o util/*.o shapes/*.o parser/*.o $(CXXFLAGS) $(LDFLAGS)
@for d in $(SUBDIRS); \
do $(MAKE) -C $$d; \
ret=$$?; \
if [[ $$ret != 0 ]]; then \
exit $$ret; \
fi; \
done
$(CXX) -o $@ $(patsubst %,%/*.o,$(SUBDIRS)) $(CXXFLAGS) $(LDFLAGS)
clean:
make -C parser clean CLEAN=1
make -C main clean CLEAN=1
make -C shapes clean CLEAN=1
make -C util clean CLEAN=1
@for d in $(SUBDIRS); \
do $(MAKE) -C $$d clean CLEAN=1; \
done
-rm -f $(TARGET)

View File

@ -18,6 +18,6 @@ clean:
-$(RM) -f *.o *.dep
# Include dependency files
ifndef clean
ifndef CLEAN
-include $(DEPS)
endif