-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.am
225 lines (177 loc) · 6 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
AUTOMAKE_OPTIONS=foreign no-installinfo no-installman
ACLOCAL_AMFLAGS=-I./m4
# make sure any third-party makefile
# inherits these settings which
# may be embedded in installation paths...
# (This is some hack)
export rtems_bsp
export RTEMS_BSP
export enable_rtemsbsp
export package_subdir
export host_alias
export host_cpu
export host_os
HOSTCC = @HOSTCC@
SUBDIRS = @THESUBDIRS@
HOSTCFLAGS=-O2 -g
MOSTLYCLEANFILES =
CLEANFILES =
if USETECLA
TECLA_SRCS = teclastuff.c
TECLALIBP = -L@LIBTECLA@
TECLALIBS = -ltecla_r
TECLAINCS = -I@srcdir@/@LIBTECLA@
endif
PTHREADLIBS = @LIBPTHREAD@
SYMF_SRCS =
SYMLIBP =
SYMLIBS =
SYMINCS =
if USELOADER
SYMF_SRCS += bfdstuff.c
else
if USEELFSYMS
# ELF symbol file reader only
SYMF_SRCS += elfsyms.c
SYMF_SRCS += elfdlmap.c
else
# no symbol file reader at all,
# builtin symtab only
SYMF_SRCS += noloader.c
endif
endif #USELOADER
if USEOPCODES
SYMF_SRCS += bfd-disas.c
endif
if USEBFD
SYMINCS += -I@srcdir@/@BINUTILS@/include -I@srcdir@/@BINUTILS@/bfd -I@BINUTILS@/bfd
SYMLIBP += -L@BINUTILS@/bfd/.libs -L@BINUTILS@/libiberty
if USEOPCODES
SYMLIBS += -lopcodes
SYMLIBP += -L@BINUTILS@/opcodes/.libs
endif
SYMLIBS += -lbfd
SYMLIBS += -liberty
xsyms_CPPFLAGS = -I@srcdir@/@BINUTILS@/include -I@srcdir@/@BINUTILS@/bfd -I@BINUTILS@/bfd
xsyms_LDADD = -L@BINUTILS@/bfd/.libs -L@BINUTILS@/libiberty -lbfd -liberty
gencore_CPPFLAGS = -I@srcdir@/@BINUTILS@/include -I@srcdir@/@BINUTILS@/bfd -I@BINUTILS@/bfd
gencore_LDADD = -L@BINUTILS@/bfd/.libs -L@BINUTILS@/libiberty -lbfd -liberty
else # USEBFD
SYMINCS += -I$(srcdir)/pmbfd
SYMLIBP += -Lpmbfd
if USEPMBFD
if USEOPCODES
SYMINCS += -I$(srcdir)/@BINUTILS@/include -I@BINUTILS@/bfd
SYMLIBP += -L@BINUTILS@/opcodes/.libs -L@BINUTILS@/libiberty
SYMLIBS += -lopcodes -liberty -lpmbfd
else
if USELOADER
SYMLIBS += -lpmbfd
endif
endif
SYMLIBS += -lpmelf
endif #USEPMBFD
xsyms_CPPFLAGS = -I$(srcdir)/pmbfd
xsyms_LDADD = -Lpmbfd -lpmbfd -lpmelf
endif #USEBFD
if USELOADER
SEGS_SRCS = cexpsegs.c cexpsegs-alloc.c
endif
SRCS = cexplock.h ctyps.h cexpsyms.h cexpsymsP.h
SRCS+= cexp.c ctyps.c cexpsyms.c vars.c rshload.c cexplock.c
SRCS+= cexpmod.h cexpmodP.h cexpmod.c vars.h cexp.tab.c cexp.tab.h
SRCS+= cexpveneer.c
SRCS+= elfdlmap.h
SRCS+= cexpsegsP.h cexp_regex.h teclastuff.h rtems-hackdefs.h
SRCS+= @srcdir@/getopt/mygetopt_r.c @srcdir@/getopt/mygetopt_r.h context.h
SRCS+= help.c
EXTRA_SRCS=
EXTRA_SRCS+= cexpsegs.c cexpsegs-alloc.c
EXTRA_SRCS+= $(SYMF_SRCS)
EXTRA_SRCS+= $(TECLA_SRCS)
EXTRA_DIST = cexp.y jumptab.c gentab.c config-ml.in
EXTRA_DIST+= $(wildcard $(srcdir)/m4/*.m4) $(srcdir)/m4/ChangeLog
EXTRA_DIST+= binutils-2.18.diff
EXTRA_DIST+= binutils-2.23.diff
EXTRA_DIST+= README.ld.snippet makefile LICENSE Makefile.syms
EXTRA_DIST+= wrap.c
EXTRA_DIST+= $(wildcard $(srcdir)/cpptest/*.c)
EXTRA_DIST+= $(wildcard $(srcdir)/cpptest/*.cc)
EXTRA_DIST+= $(wildcard $(srcdir)/cpptest/*.cpp)
EXTRA_DIST+= $(wildcard $(srcdir)/cpptest/*.h)
EXTRA_DIST+= $(wildcard $(srcdir)/cpptest/Make*)
EXTRA_DIST+= $(wildcard $(srcdir)/cpptest/st.*)
EXTRA_DIST+= makefile.top.am makefile.top.in
EXTRA_DIST+= dummycxx
xsyms_SOURCES = xsyms.c
gencore_SOURCES = gencore.c
#MDBG=/home/till/slac/xfm/src/mdbg/mdbg.o
#MDBGCFLAGS=-DUSE_MDBG -I$(dir $(MDBG))
#MDBGLDFLAGS= $(MDBG) -Wl,--wrap,malloc -Wl,--wrap,realloc -Wl,--wrap,calloc -Wl,--wrap,free
#BINUT=/home/till/gnu/binutils-2.11.1
#BFDINCS=-I$(BINUT)/include -I$(BINUT)/bfd -I$(BINUT)/$(ARCH)/bfd
#TECLA=/home/till/rtems/apps/libtecla
#ARCH=build-ppc-rtems
#BFDLIBP=-L $(BINUT)/$(ARCH)/bfd/.libs/ -L $(BINUT)/$(ARCH)/libiberty/ -L $(BINUT)/$(ARCH)/opcodes/.libs/
XTRAOBJS = $(SEGS_SRCS:%.c=%.$(OBJEXT))
XTRAOBJS+= $(SYMF_SRCS:%.c=%.$(OBJEXT))
XTRAOBJS+= $(TECLA_SRCS:%.c=%.$(OBJEXT))
XTRAOBJS+= builddate.$(OBJEXT)
if DO_CEXPLIB
lib_LIBRARIES=libcexp.a
include_HEADERS = cexp.h cexpHelp.h ctyps.h cexpsyms.h
libcexp_a_SOURCES=$(SRCS)
EXTRA_libcexp_a_SOURCES=$(EXTRA_SRCS)
AM_CPPFLAGS = -I@srcdir@/regexp
AM_CPPFLAGS += $(MDBGCFLAGS) $(SYMINCS) $(CONFIG_THREADS) $(TECLAINCS)
libcexp_a_LIBADD = $(XTRAOBJS)
libcexp_a_DEPENDENCIES=$(SYMDEPS) $(XTRAOBJS) builddate.o
if DO_DEMO
cexp_SOURCES = cexp_main.c
cexp_LDADD = -lcexp $(SYMLIBS) $(TECLALIBS) -lspencer_regexp $(wildcard cexp-builtin-symtab.$(OBJEXT)) $(PTHREADLIBS)
cexp_DEPENDENCIES=libcexp.a $(wildcard cpptest/mak.defs) $(wildcard cexp-builtin-symtab.$(OBJEXT))
cexp_LDFLAGS = -L. -Wl,-u,printf -Wl,-u,fprintf -Wl,-u,scanf -Wl,-u,fscanf $(CEXP_TEST_UNDEFS) $(SYMLIBP) $(TECLALIBP) -Lregexp $(MDBGLDFLAGS)
CEXP_TEST_UNDEFS=-Wl,-u,__cxa_finalize
-include cpptest/mak.defs
bin_PROGRAMS = cexp
bin_PROGRAMS += xsyms
cexp_LINK = $(CXX) $(AM_CFLAGS) $(CFLAGS) $(cexp_LDFLAGS) $(LDFLAGS) -o $@
endif #DO_DEMO
else #DO_CEXPLIB
# cross-tools only
gencore_CPPFLAGS = $(xsyms_CPPFLAGS)
if USEBFD
hostbin_PROGRAMS=xsyms gencore
else
hostbin_PROGRAMS=xsyms
endif
endif #DO_CEXPLIB
XSYMS=$(builddir)/xsyms
#we can't use automake for this because
# - we _need_ bison
# - our naming convention
cexpsyms.o: cexp.tab.h cexpsyms.c
cexp.tab.c cexp.tab.h: cexp.y
bison -v -d -p cexp $^
%ctyps.o: $(srcdir)/jumptab.c
$(srcdir)/jumptab.c: $(srcdir)/gentab.c
$(HOSTCC) $(HOSTCFLAGS) -o gentab $^
./gentab > $@
CLEANFILES+=gentab
builddate.c: $(libcexp_a_SOURCES) $(EXTRA_SRCS) Makefile
echo 'char *cexp_build_date="'`date +%Y%m%d%Z%T`'";' > $@
MOSTLYCLEANFILES+=builddate.c
install: all-recursive install-recursive
builtin-symtab: cexp-builtin-symtab.$(OBJEXT)
cexp-builtin-symtab.c: cexp
$(XSYMS) -C $^ $@
cexp-builtin-symtab.$(OBJEXT): cexp-builtin-symtab.c
$(CC) -c -I$(srcdir) $(CFLAGS) -o $@ $^
cexp_main.c:
@echo '#include "cexp.h"' > $@
@echo 'int main(int argc, char **argv) { return cexp_main(argc,argv); }' >>$@
dist-hook:
if test "$(PACKAGE_VERSION)" = "untagged" ; then \
echo "Need tagged version to cut a dist!"; \
exit 1; \
fi