forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.am
154 lines (124 loc) · 5.23 KB
/
Makefile.am
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Copyright 2013-present Barefoot Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = -I$(srcdir)/frontends -I$(srcdir)/backends -I$(srcdir)/extensions -Wall -Wextra \
-Wno-overloaded-virtual -Wno-deprecated
AM_YFLAGS = -v
TOOLSDIR=$(srcdir)/tools
GENTESTS=$(TOOLSDIR)/gen-tests.py
GEN_UNIFIED_MAKEFILE=$(TOOLSDIR)/gen-unified-makefile.py
GEN_UNIFIED_CPP=$(TOOLSDIR)/gen-unified-sources.py
.l.c:
$(LEX.l) $< > $@
################ Variables populated in subproject Makefiles
# Please use += to append values to these variables.
# Standard automake variables.
CLEANFILES = # Files to remove on clean
bin_PROGRAMS = # Binaries built
noinst_LTLIBRARIES = # Libtool convenience libraries
noinst_HEADERS = # Headers that are not installed
noinst_LIBRARIES = # Static libraries built
noinst_PROGRAMS = # Binaries built that are not installed
BUILT_SOURCES = # Generated source files
TESTS = # Tests to execute
# Variables specific to our build system.
XFAIL_TESTS = $(IFAIL_TESTS) # Tests that are supposed to fail
IFAIL_TESTS = # intermittent failures
export XFAIL_TESTS
export IFAIL_TESTS
cpplint_FILES = # Files that should be passed to cpplint (and etags)
ir_DEF_FILES = # Files that generate the IR
extension_frontend_SOURCES = # Files added to libfrontend by extensions
p4include_HEADERS = # p4_16 include files
p4_14include_HEADERS = # p4_14 include files
################ Subproject Makefile inclusions
include $(srcdir)/lib/Makefile.am
include $(srcdir)/tools/ir-generator/Makefile.am
include $(srcdir)/ir/Makefile.am
include $(srcdir)/frontends/Makefile.am
include $(srcdir)/midend/Makefile.am
# The following files are generated by scripts.
include $(srcdir)/otherMakefiles.am
$(srcdir)/otherMakefiles.am: $(srcdir)/find-makefiles.sh $(wildcard $(srcdir)/backends/*/Makefile.am $(srcdir)/extensions/*/Makefile.am)
cd $(srcdir); ./find-makefiles.sh
include $(srcdir)/unified-compilation.am
include $(srcdir)/regenerate-unified-compilation.am
######## Generate C++ IR files from *.def files using ir-generator
# make is very stupid regarding multiple files generated from the same source
# this pattern ensures that parallel builds continue to work
ir/ir-generated.h: irgenerator $(ir_DEF_FILES)
./irgenerator -t ir/gen-tree-macro.h -i ir/ir-generated.cpp $(ir_DEF_FILES) >$@ || ( rm $@ && false )
@$(srcdir)/tools/fixup-line-directives $@ >[email protected]
@mv [email protected] $@
ir/gen-tree-macro.h: ir/ir-generated.h
@$(srcdir)/tools/fixup-line-directives $@ >[email protected]
@mv [email protected] $@
ir/ir-generated.cpp: ir/ir-generated.h
@$(srcdir)/tools/fixup-line-directives $@ >[email protected]
@mv [email protected] $@
BUILT_SOURCES += \
ir/ir-generated.h \
ir/ir-generated.cpp \
ir/gen-tree-macro.h
######## P4 header files to install
# FIXME -- should these be in $(pkgdatadir) or $(prefix)? setup.h.in
# FIXME -- and check-install-headers: below need to be consistent
p4includedir = $(pkgdatadir)/p4include
p4_14includedir = $(pkgdatadir)/p4_14include
p4include_HEADERS += $(srcdir)/p4include/core.p4 $(srcdir)/p4include/v1model.p4
#### For testing, install headers in the build directory
all-local:
@$(MAKE) install-data pkgdatadir=$(builddir)
# FIXME -- should be a way of getting configure to do this automatcially? or automake?
setup.h: $(srcdir)/setup.h.in Makefile
@sed -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
-e 's|@prefix[@]|$(prefix)|g' \
-e 's|@p4includedir[@]|$(p4includedir)|g' \
-e 's|@p4_14includedir[@]|$(p4_14includedir)|g' \
$< >$@
setup.o setup.lo: setup.h
################
# Front-end library
noinst_LTLIBRARIES += libfrontend.la
libfrontend_la_SOURCES = \
setup.h \
setup.cpp \
$(frontend_SOURCES) \
$(midend_SOURCES) \
$(ir_SOURCES) \
ir/ir-generated.cpp \
$(extension_frontend_SOURCES)
# unit tests
include $(srcdir)/test/Makefile.am
# Lint all header files.
cpplint_FILES += $(noinst_HEADERS)
################ Misc custom targets
clean-local:
-rm -f $(BUILT_SOURCES) $(CLEANFILES)
cpplint:
@cd $(srcdir); tools/cpplint.py --root=. --extensions=h,hpp,c,cpp,ypp,l $(sort $(cpplint_FILES))
tags:
cd $(srcdir); ctags -R --langmap=C++:+.def,Flex:+.l,YACC:+.ypp \
backends extensions frontends ir lib tools midend
cd $(srcdir)/tools/ir-generator; ctags -R --langmap=Flex:+.l,YACC:+.ypp \
. ../../lib
etags:
cd $(srcdir); ctags -e -R --langmap=C++:+.def,Flex:+.l,YACC:+.ypp \
backends extensions frontends ir lib tools midend
cd $(srcdir)/tools/ir-generator; ctags -e -R --langmap=Flex:+.l,YACC:+.ypp \
. ../../lib
check-%:
@$(MAKE) check TESTS="$(filter $*/%, $(TESTS) $(EXTRA_TESTS))"
recheck-%:
@$(MAKE) recheck TESTS="$(filter $*/%, $(TESTS) $(EXTRA_TESTS))"