forked from andrewytliu/cspice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
43 lines (31 loc) · 985 Bytes
/
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
LEX = flex
YACC = bison
LEX_FLAG = -Pparse
YACC_FLAG = -d -p parse
CXX = g++
#CFLAGS = -g -Iinclude
CFLAGS = -O3 -Iinclude -Wall
CSRCS = $(wildcard src/*.cpp)
CHDRS = $(wildcard include/*.h)
#COBJS = $(addsuffix .o, $(basename $(CSRCS)))
COBJS = obj/main.o obj/simulator.o obj/circuit.o obj/utils.o obj/parseLEX.o obj/parseYY.o
all : bin/cspice
src/parseLEX.cpp: src/parser.l src/parseYY.hpp
@echo "> lexing: $<"
@$(LEX) $(LEX_FLAG) -o$@ $<
src/parseYY.cpp src/parseYY.hpp: src/parser.y
@echo "> yaccing: $<"
@$(YACC) $(YACC_FLAG) -o parseYY.cpp $<
@mv parseYY.cpp src/parseYY.cpp
@mv parseYY.hpp src/parseYY.hpp
@ln -sf src/parseYY.hpp include/parseYY.hpp
obj/parseYY.o : src/parser.cpp
bin/cspice : $(COBJS)
$(CXX) $(CFLAGS) -o $@ $(COBJS)
obj/%.o : src/%.c
$(CXX) $(CFLAGS) -c -o $@ $<
obj/%.o : src/%.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
$(COBJS) : $(CHDRS)
clean:
-rm -f obj/* bin/* src/parseYY.cpp src/parseYY.hpp src/parseLEX.cpp