-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (41 loc) · 1.12 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Makefile to create libpilal.a as well as
# test files
# Compiler options
# Calls: $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
PREFIX = .
CXX = g++
CXXFLAGS = -Wall -W -pedantic-errors -g -Wno-unused-parameter # -Werror
CXXFLAGS += -Wmissing-braces -Wparentheses -ansi
# Directories
LIBDIR = $(PREFIX)/lib
BINDIR = $(PREFIX)/bin
SRCDIR = $(PREFIX)/solver
PILDIR = $(PREFIX)/pilal
SIMDIR = $(PREFIX)/simplex
CPPFLAGS = -I$(PILDIR)/include -I$(SIMDIR)/include
# Linker options
# Calls: $(CC) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o -$@
CC = g++
# Cleaning options
RM = rm -rf
# Files
SRCF = $(wildcard $(SRCDIR)/*.cc) $(wildcard $(PILDIR)/src/*.cc) $(wildcard $(SIMDIR)/src/*.cc)
DEPS = $(SRCF:.cc=.d*)
OBJS = $(SRCF:.cc=.o)
BINS = $(BINDIR)/solver
# Targets
# all library clean wipe
.PHONY: all clean wipe
all: $(BINDIR)/solver
$(BINDIR)/solver: $(OBJS)
$(CC) $^ -o $@
clean:
$(RM) $(OBJS) $(DEPS)
wipe:
$(RM) $(OBJS) $(DEPS) $(BINS)
%.d: %.cc
@set -e; rm -f $@; \
$(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$ \
include $(SRCF:.cc=.d)