forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (27 loc) · 1.01 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Make any tests, and possibly run them.
# A selection of variables are exported from the master Makefile
# libtap.so and tap.h must be in the local directory or on the system path.
# ODIR is realative, so we can use the one from the main Makefile
# As each test will have a main function we need to handle this file by file
TEST_SOURCES = $(wildcard *_test.cpp)
TEST_OBJS = $(TEST_SOURCES:%.cpp=$(ODIR)/%.o)
TESTS = $(TEST_SOURCES:.cpp=)
# Brute force solution, relative paths to EVERY .o file
SOURCE_OBJS = $(patsubst %,../$(ODIR)/%,$(filter-out main.o,$(_OBJS)))
LDFLAGS += -L. -ltap -lpthread
CXXFLAGS += -I..
LD := $(CROSS)g++
tests: $(TESTS)
%_test: $(ODIR) $(DDIR) $(SOURCE_OBJS) $(TEST_OBJS)
$(LD) $(W32FLAGS) -o $@ $(DEFINES) $(ODIR)/[email protected] $(SOURCE_OBJS) $(CXXFLAGS) $(LDFLAGS)
check: $(TESTS)
LD_LIBRARY_PATH=/usr/local/lib ./$?
clean:
rm -f $(TESTS) *.d $(ODIR)/*.o $(ODIR)/*.d
$(ODIR):
mkdir $(ODIR)
$(DDIR):
@mkdir $(DDIR)
$(ODIR)/%.o: %.cpp
$(CXX) $(DEFINES) $(CXXFLAGS) -c $< -o $@
.PHONY: clean