-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
61 lines (45 loc) · 1.38 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
61
TARGET = sjc
LIBS = -lm
CC = g++
ifeq ($(mode),release)
CFLAGS = -g -O3 -Wall -std=c++11 -Iinclude -Wno-reorder
else
mode = debug
CFLAGS = -g -Wall -std=c++11 -Iinclude -Wno-reorder
endif
ifeq ($(platform),windows)
EXTRALINKFLAGS = -lwsock32
else
EXTRALINKFLAGS =
endif
CFILES = $(wildcard src/*.cpp)
COBJECTS = $(subst src/,build/,$(patsubst %.cpp, %.o, $(CFILES)))
ALLOBJECTS = $(COBJECTS) parser/parser.o parser/tokens.o
HEADERS = $(wildcard include/*.h)
.PHONY: default all clean
.PRECIOUS: $(TARGET) $(OBJECTS)
all: default
default: $(TARGET)
clean:
-rm -f build/*.o
-rm -f include/*.gch
-rm -f $(TARGET)
-rm -f $(TARGET).exe
-rm -f parser/parser.cpp parser/tokens.cpp
install:
cp sjc.exe /usr/bin
parser/parser.cpp: parser/parser.y
bison -v -d -l -o $@ $^
parser/parser.hpp: parser/parser.cpp
parser/tokens.cpp: parser/tokens.l
flex -L -o $@ $^
include/sjc.h.gch : $(HEADERS)
$(CC) $(CFLAGS) -c include/sjc.h -o include/sjc.h.gch -Wno-deprecated
parser/parser.o: parser/parser.cpp
$(CC) $(CFLAGS) -Wno-unused-const-variable -c $^ -o $@
parser/tokens.o: parser/tokens.cpp
$(CC) $(CFLAGS) -Wno-deprecated-register -Wno-unused-const-variable -c $^ -o $@
build/%.o: src/%.cpp include/sjc.h.gch
$(CC) $(CFLAGS) -c $< -o $@
$(TARGET): $(ALLOBJECTS)
$(CC) $(ALLOBJECTS) -Wall $(LIBS) -o $@ -lboost_system-mt -lboost_filesystem-mt -lboost_program_options-mt $(EXTRALINKFLAGS)