File: Makefile

package info (click to toggle)
phabricator 0~git20190207-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 71,728 kB
  • sloc: php: 552,244; sql: 16,997; ansic: 3,619; yacc: 2,503; sh: 754; xml: 519; lex: 488; cpp: 221; python: 186; makefile: 177; sed: 66
file content (77 lines) | stat: -rw-r--r-- 1,579 bytes parent folder | download | duplicates (2)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
BISONFLAGS = --verbose -Wall
CPPFLAGS   = -fPIC -Wall
FLEXFLAGS  = -CFr

ifdef DEBUG
	BISONFLAGS += --debug
	CPPFLAGS   += -ggdb -DDEBUG
	FLEXFLAGS  += --debug
else
	CPPFLAGS  += -O3 -minline-all-stringops
endif

ifdef PROFILE
	CPPFLAGS += -pg
endif

ifdef STATIC
	CPPFLAGS += -static
endif

ifdef MSYSTEM
	CPPFLAGS += -static-libgcc -static-libstdc++
endif

ROOT = ../../src/parser/xhpast

.PHONY: all
all: xhpast

clean:
	rm -f xhpast parser.yacc.output libxhpast.a *.o

cleanall: clean
	rm -f scanner.lex.hpp scanner.lex.cpp parser.yacc.hpp parser.yacc.cpp
	rm -f node_names.hpp parser_nodes.php

.PHONY: install
install: xhpast
	cp xhpast $(ROOT)/bin/xhpast

.PHONY: parser scanner

parser: parser.yacc.hpp parser.yacc.cpp
scanner: scanner.lex.hpp scanner.lex.cpp

%.lex.hpp %.lex.cpp: %.l
ifndef SKIP_SCANNER
	flex $(FLEXFLAGS) --header-file=$*.lex.hpp --outfile=$*.lex.cpp $<
	@echo '/* @gen''er''ated */' >> $*.lex.hpp
	@echo '/* @gen''er''ated */' >> $*.lex.cpp
else
	touch $*.lex.hpp $*.lex.cpp
endif

%.yacc.hpp %.yacc.cpp: %.y
ifndef SKIP_PARSER
	bison $(BISONFLAGS) --defines=$*.yacc.hpp --output=$*.yacc.cpp $<
	@echo '/* @gen''er''ated */' >> $*.yacc.hpp
	@echo '/* @gen''er''ated */' >> $*.yacc.cpp
else
	touch $*.yacc.hpp $*.yacc.cpp
endif

%.o: %.cpp
	$(CXX) -c $(CPPFLAGS) -o $@ $<

node_names.hpp parser_nodes.php: generate_nodes.php
	php -f $<

parser.yacc.o: scanner.lex.hpp
scanner.lex.o: parser.yacc.hpp node_names.hpp scanner.lex.hpp

libxhpast.a: scanner.lex.o parser.yacc.o
	$(AR) -crs $@ $^

xhpast: xhpast.cpp libxhpast.a
	$(CXX) $(CPPFLAGS) -o $@ $^