summaryrefslogtreecommitdiff
path: root/dwarfdump/Makefile.in
blob: 19278f3b19e709bc736bc7ffb0956a1311d73d9e (plain)
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
#
#  Makefile for dwarfdump
#  This is made very simple so it should work with
#  any 'make'.
#  The Makefile does assume that libdwarf is at ../libdwarf
#  from the dwarfdump2 source directory.
#

srcdir =	@srcdir@
VPATH =		@srcdir@

prefix =	@prefix@
exec_prefix =	@exec_prefix@
bindir =	$(exec_prefix)/bin
libdir =	$(exec_prefix)/lib
mandir =        $(exec_prefix)/share/man
man1dir =       $(mandir)/man1


INSTALL =	@INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA =	@INSTALL_DATA@
DATAROOT =      @datarootdir@
SHELL =		/bin/sh
CC =		@CC@
AR =		@AR@
ARFLAGS =	@ARFLAGS@
RM =		rm
RANLIB =	@RANLIB@
DEFS =		@DEFS@
# ../libdwarf gets us to local headers and a libdwarf 
# archive, usually, so we assume it.
DIRINC =        $(srcdir)/../libdwarf
LIBS =		@LIBS@ -L../libdwarf -ldwarf -lelf
INCLUDES =	-I. -I$(srcdir) -I$(srcdir)/../libdwarf
CFLAGS =	$(PREINCS) @CFLAGS@ $(INCLUDES) -DCONFPREFIX=${libdir} $(POSTINCS)
LDFLAGS =	$(PRELIBS) @LDFLAGS@  $(LIBS) $(POSTLIBS)


INSTALL = cp

binprefix =

FINALOBJECTS = \
	addrmap.o \
        checkutil.o \
	dwarfdump.o \
	dwconf.o \
	esb.o \
	print_abbrevs.o \
	print_aranges.o \
	print_die.o \
	print_frames.o  \
	print_lines.o \
	print_locs.o \
	print_macros.o \
	print_pubnames.o \
	print_ranges.o \
	print_reloc.o \
	print_sections.o  \
	print_static_funcs.o  \
	print_static_vars.o  \
	print_strings.o \
	print_types.o \
	print_weaknames.o  \
        strstrnocase.o \
        uri.o
GEN_HFILES = common.o \
	tmp-tt-table.c \
	tmp-ta-table.c \
	tmp-ta-ext-table.c \
	tmp-tt-ext-table.c 

all: dwarfdump

HEADERS = $(srcdir)/checkutil.h \
        $(srcdir)/common.h \
        $(srcdir)/dwconf.h \
        $(srcdir)/esb.h \
        $(srcdir)/globals.h \
        $(srcdir)/makename.h \
        $(srcdir)/print_frames.h \
        $(srcdir)/uri.h

$(FINALOBJECTS): $(GEN_HFILES)  $(HEADERS) $(srcdir)/naming.c

default: $(TARGETS)

dwarfdump: $(FINALOBJECTS) makename.o naming.o common.o
	$(CC) $(CFLAGS) -o $@ $(FINALOBJECTS) common.o makename.o naming.o $(LDFLAGS) 

#tag_common.o: $(srcdir)/tag_common.c $(HEADERS)  dwarf_names.h
#	$(CC) $(CFLAGS) -c $(srcdir)/tag_common.c
makename.o: $(srcdir)/makename.h $(srcdir)/makename.c 
	$(CC) $(CFLAGS) -c $(srcdir)/makename.c
common.o:  $(srcdir)/common.c $(srcdir)/common.h
	$(CC) $(CFLAGS) -c $(srcdir)/common.c
gennames: $(srcdir)/gennames.c $(DIRINC)/dwarf.h $(HEADERS) common.o
	$(CC) $(CFLAGS) $(srcdir)/gennames.c common.o $(LDFLAGS) -o gennames
naming.o:  $(srcdir)/naming.c $(srcdir)/naming.h
	$(CC) $(CFLAGS) -c $(srcdir)/naming.c

# We need this as naming.o has external references we cannot have
# in the tree builds.
trivial_naming.o: $(srcdir)/naming.c
	$(CC) $(CFLAGS) -DTRIVIAL_NAMING  -c $(srcdir)/naming.c -o trivial_naming.o 

tag_tree_build:  $(srcdir)/tag_tree.c $(DIRINC)/dwarf.h $(HEADERS) tag_common.o makename.o common.o trivial_naming.o
	$(CC) $(CFLAGS) $(srcdir)/tag_tree.c tag_common.o common.o makename.o trivial_naming.o $(LDFLAGS) -o tag_tree_build 

tag_attr_build:  $(srcdir)/tag_attr.c $(DIRINC)/dwarf.h $(HEADERS) tag_common.o makename.o common.o trivial_naming.o
	$(CC) $(CFLAGS) $(srcdir)/tag_attr.c tag_common.o common.o makename.o trivial_naming.o $(LDFLAGS) -o tag_attr_build 

tmp-tt-table.c tmp-tt-ext-table.c: $(srcdir)/tag_tree_ext.list $(srcdir)/tag_tree.list tag_tree_build
	# gcc -E tag_tree.list does not work, so use a .c name
	-rm -f  tmp-t1.c
	cp $(srcdir)/tag_tree.list tmp-t1.c
	$(CC) $(CFLAGS) -E tmp-t1.c  > ./tmp-tag-tree-build1.tmp
	./tag_tree_build -s  -i tmp-tag-tree-build1.tmp  -o tmp-tt-table.c
	-rm -f tmp-t4.c
	cp $(srcdir)/tag_tree_ext.list tmp-t4.c
	$(CC) $(CFLAGS) -E tmp-t4.c  > ./tmp-tag-tree-build4.tmp
	./tag_tree_build -e  -i tmp-tag-tree-build4.tmp -o tmp-tt-ext-table.c

tmp-ta-table.c tmp-ta-ext-table.c: $(srcdir)/tag_attr_ext.list $(srcdir)/tag_attr.list tag_attr_build
	# gcc -E tag_attr.list does not work, so use a .c name
	-rm -f tmp-t2.c
	cp $(srcdir)/tag_attr.list tmp-t2.c
	$(CC) $(CFLAGS)  -E tmp-t2.c  > ./tmp-tag-attr-build2.tmp
	./tag_attr_build -s -i tmp-tag-attr-build2.tmp -o tmp-ta-table.c
	-rm -f tmp-t3.c
	cp $(srcdir)/tag_attr_ext.list tmp-t3.c
	$(CC) $(CFLAGS)  -E tmp-t3.c  > ./tmp-tag-attr-build3.tmp
	./tag_attr_build -e -i tmp-tag-attr-build3.tmp -o tmp-ta-ext-table.c


# The file dwarf_names.awk generates BOTH dwarf_names.h and dwarf_names.c
#   be careful of the make dependencies here
dwarf_names.h: gennames $(DIRINC)/dwarf.h
	rm -f dwarf_names.h dwarf_names.c
	./gennames -s  -i ../libdwarf -o .
dwarf_names.c: dwarf_names.h

test: esb.o $(srcdir)/testesb.c
	$(CC) -o test $(srcdir)/testesb.c esb.o
	./test
	-rm -f ./test


# This simply assumes that a default INSTALL (cp) command
# will work and leave sensible permissions on the resulting files.
# Some adjustment might be required, see README.
install: all
	$(INSTALL) dwarfdump $(bindir)/dwarfdump
	$(INSTALL) $(srcdir)/dwarfdump.conf $(libdir)/dwarfdump.conf
	$(INSTALL) $(srcdir)/dwarfdump.1 $(man1dir)/dwarfdump.1

uninstall:
	-rm -f $(bindir)/dwarfdump
	-rm -f $(man1dir)/dwarfdump.1
	-rm -f $(libdir)/dwarfdump.conf

clean:
	rm -f *.o dwarfdump 
	rm -f _tag_attr_table.c 
	rm -f _tag_attr_ext_table.c 
	rm -f _tag_tree_table.c 
	rm -f _tag_tree_ext_table.c 
	-rm -f tag_attr_build*.tmp
	-rm -f tag_tree_build*.tmp
	rm -f tag_tree_build
	rm -f tag_attr_build
	-rm -f _*.c _*.h
	-rm -f tmp-*.c tmp-*.h tmp-*.tmp
	rm -f gennames
	rm -f dwarf_names_new.c
	rm -f dwarf_names_new.h
	rm -f dwarf_names_enum.h
	rm -f dwarf_names.h 
	rm -f dwarf_names.c


distclean: clean
	rm -f config.log config.h config.cache config.status 
	rm -rf autom4te.cache
	rm -rf Makefile

shar:
	@echo "shar not set up yet"
dist:
	@echo "dist not set up yet"