switch build system to SCons
This commit is contained in:
parent
c218c8956f
commit
9b8f3290ad
35
Makefile
35
Makefile
@ -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
25
SConstruct
Normal 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)
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user