switch build system to SCons

This commit is contained in:
Josh Holtrop 2011-02-10 11:47:49 -05:00
parent c218c8956f
commit 9b8f3290ad
8 changed files with 31 additions and 158 deletions

View File

@ -1,33 +1,10 @@
export SCONSFLAGS := -Q
SHELL := bash
all:
@scons
TARGET := fart
ifdef WIN32
export CPPFLAGS += -I"$(shell cd)"
else
export CPPFLAGS += -I"$(shell pwd)"
endif
export CXXFLAGS := -Wall -O2
LDFLAGS := -lfl -lpthread -lfreeimage
SUBDIRS := util shapes main parser distrib
all: $(TARGET)
.PHONY: $(TARGET)
$(TARGET):
@for d in $(SUBDIRS); \
do $(MAKE) -C $$d; \
ret=$$?; \
if [[ $$ret != 0 ]]; then \
exit $$ret; \
fi; \
done
$(CXX) -o $@ $(patsubst %,%/*.o,$(SUBDIRS)) $(CXXFLAGS) $(LDFLAGS)
install:
@scons $@
clean:
@for d in $(SUBDIRS); \
do $(MAKE) -C $$d clean CLEAN=1; \
done
-rm -f $(TARGET)
@scons -c

25
SConstruct Normal file
View File

@ -0,0 +1,25 @@
# vim:syntax=python
import os
target = 'fart'
subdirs = ['util', 'shapes', 'main', 'distrib']
parser_sources = Glob('parser/*.cc')
sources = map(lambda x: Glob(x + '/*.cc'), subdirs)
lexer_source = 'parser/lex.yy.cc'
parser_source = 'parser/parser.tab.cc'
for f in parser_sources:
if str(f) != lexer_source and str(f) != parser_source:
sources.append(f)
sources += [lexer_source, parser_source]
env = Environment(CPPFLAGS = '-I.',
CXXFLAGS = '-Wall -O2',
YACCFLAGS = '-d',
LIBS = ['-lfl', '-lpthread', '-lfreeimage'])
lexer = env.CXXFile(lexer_source, 'parser/parser.ll')
parser = env.CXXFile(parser_source, 'parser/parser.yy')
env.Depends(lexer, parser_source)
env.Program(target, sources)

View File

@ -1,23 +0,0 @@
OBJS := $(patsubst %.cc,%.o,$(wildcard *.cc))
DEPS := $(OBJS:.o=.dep)
all: $(DEPS) $(OBJS)
%.o: %.cc
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
# Make dependency files
%.dep: %.cc
@set -e; rm -f $@; \
$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
clean:
-$(RM) -f *.o *.dep
# Include dependency files
ifndef CLEAN
-include $(DEPS)
endif

View File

@ -1,23 +0,0 @@
OBJS := $(patsubst %.cc,%.o,$(wildcard *.cc))
DEPS := $(OBJS:.o=.dep)
all: $(DEPS) $(OBJS)
%.o: %.cc
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
# Make dependency files
%.dep: %.cc
@set -e; rm -f $@; \
$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
clean:
-$(RM) -f *.o *.dep
# Include dependency files
ifndef CLEAN
-include $(DEPS)
endif

View File

@ -1,37 +0,0 @@
FLEX := flex
BISON := bison
PARSER := parser
OBJS := lex.yy.o $(PARSER).tab.o $(patsubst %.cc,%.o,$(wildcard *.cc))
DEPS := $(OBJS:.o=.dep)
all: $(DEPS) $(OBJS)
%.o: %.cc
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
$(PARSER).tab.cc $(PARSER).tab.hh: $(PARSER).yy
$(BISON) -d $<
lex.yy.o: lex.yy.cc
lex.yy.cc: $(PARSER).tab.hh
lex.yy.cc: $(PARSER).lex
$(FLEX) -o $@ $<
# Make dependency files
%.dep: %.cc
@set -e; rm -f $@; \
$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
clean:
-rm -f lex.yy.cc $(PARSER).tab.cc $(PARSER).tab.hh *~ *.o *.dep
# Include dependency files
ifndef CLEAN
-include $(DEPS)
endif

View File

@ -1,23 +0,0 @@
OBJS := $(patsubst %.cc,%.o,$(wildcard *.cc))
DEPS := $(OBJS:.o=.dep)
all: $(DEPS) $(OBJS)
%.o: %.cc
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
# Make dependency files
%.dep: %.cc
@set -e; rm -f $@; \
$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
clean:
-$(RM) -f *.o *.dep
# Include dependency files
ifndef clean
-include $(DEPS)
endif

View File

@ -1,23 +0,0 @@
OBJS := $(patsubst %.cc,%.o,$(wildcard *.cc))
DEPS := $(OBJS:.o=.dep)
all: $(DEPS) $(OBJS)
%.o: %.cc
$(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $<
# Make dependency files
%.dep: %.cc
@set -e; rm -f $@; \
$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
clean:
-$(RM) -f *.o *.dep
# Include dependency files
ifndef CLEAN
-include $(DEPS)
endif