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:
parent
195593cc9b
commit
f103b71ed6
22
Makefile
22
Makefile
@ -9,19 +9,23 @@ export CXXFLAGS := -Wall -O2
|
|||||||
|
|
||||||
LDFLAGS := -lfl
|
LDFLAGS := -lfl
|
||||||
|
|
||||||
|
SUBDIRS := util shapes main parser
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
.PHONY: $(TARGET)
|
.PHONY: $(TARGET)
|
||||||
$(TARGET):
|
$(TARGET):
|
||||||
make -C util
|
@for d in $(SUBDIRS); \
|
||||||
make -C shapes
|
do $(MAKE) -C $$d; \
|
||||||
make -C main
|
ret=$$?; \
|
||||||
make -C parser
|
if [[ $$ret != 0 ]]; then \
|
||||||
$(CXX) -o $@ main/*.o util/*.o shapes/*.o parser/*.o $(CXXFLAGS) $(LDFLAGS)
|
exit $$ret; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
$(CXX) -o $@ $(patsubst %,%/*.o,$(SUBDIRS)) $(CXXFLAGS) $(LDFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
make -C parser clean CLEAN=1
|
@for d in $(SUBDIRS); \
|
||||||
make -C main clean CLEAN=1
|
do $(MAKE) -C $$d clean CLEAN=1; \
|
||||||
make -C shapes clean CLEAN=1
|
done
|
||||||
make -C util clean CLEAN=1
|
|
||||||
-rm -f $(TARGET)
|
-rm -f $(TARGET)
|
||||||
|
@ -18,6 +18,6 @@ clean:
|
|||||||
-$(RM) -f *.o *.dep
|
-$(RM) -f *.o *.dep
|
||||||
|
|
||||||
# Include dependency files
|
# Include dependency files
|
||||||
ifndef clean
|
ifndef CLEAN
|
||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
endif
|
endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user