-
Notifications
You must be signed in to change notification settings - Fork 41
/
Makefile.in
140 lines (114 loc) · 3.99 KB
/
Makefile.in
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
srcdir = @srcdir@
abs_top_srcdir = @abs_top_srcdir@
abs_top_builddir = @abs_top_builddir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
CC = @CC@
CPU = @target_cpu@
TARGET = @target_alias@
SYMBOL_PREFIX = @SYMBOL_PREFIX@
CFLAGS = @CFLAGS@
INCLUDES = -I$(srcdir) -Ibfd-headers @zlib_include_dir@
BFD_INCLUDE_DIR = @bfd_include_dir@
BINUTILS_INCLUDE_DIR = @binutils_include_dir@
CPPFLAGS = @CPPFLAGS@ $(DEFS) $(INCLUDES)
LDFLAGS = @LDFLAGS@
LDLIBS = @LIBS@
INSTALL = @INSTALL@
DEFS = @DEFS@ \
-DTARGET_$(CPU) \
-DTARGET_CPU=\"$(CPU)\" \
-DSYMBOL_PREFIX=\"$(SYMBOL_PREFIX)\" \
-DBINUTILS_LDSCRIPTDIR=\"@binutils_ldscript_dir@\" \
-DTARGET_ALIAS=\"$(TARGET)\" \
-DNO_GOT_CHECK=@got_check@ \
-DUSE_EMIT_RELOCS=@emit_relocs@ \
-DEMIT_CTOR_DTOR=@emit_ctor_dtor@ \
-DALWAYS_RELOC_TEXT=@always_reloc_text@ \
-DHAVE_BFD_XTENSA_PDIFF_RELOCS=@HAVE_BFD_XTENSA_PDIFF_RELOCS@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
HOST = @host_alias@
ifneq (,$(findstring mingw32,$(HOST)))
LDLIBS += -lws2_32
endif
LDFILE= elf2flt.ld
ifeq ($(strip $(CPU)),e1)
SRC_LDFILE= $(srcdir)/$(CPU)-elf2flt.ld
else
SRC_LDFILE= elf2flt.ld
endif
target_bindir = $(prefix)/$(TARGET)/bin
target_libdir = $(prefix)/$(TARGET)/lib
PROG_ELF2FLT = elf2flt$(EXEEXT)
PROG_FLTHDR = flthdr$(EXEEXT)
PROG_LD_ELF2FLT_C = ld-elf2flt$(EXEEXT)
PROG_LD_ELF2FLT_SH = ld-elf2flt.sh
ifeq (@use_ld_elf2flt_binary@,yes)
PROG_LD_ELF2FLT = $(PROG_LD_ELF2FLT_C)
else
PROG_LD_ELF2FLT = $(PROG_LD_ELF2FLT_SH)
endif
PROGS = $(PROG_ELF2FLT) $(PROG_FLTHDR) $(PROG_LD_ELF2FLT_C) $(PROG_LD_ELF2FLT_SH)
all: $(PROGS)
# We need to declare the link explicitly because make only provides
# implicit rules when EXEEXT is set to nothing
link = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(PROG_ELF2FLT): elf2flt.o compress.o stubs.o
$(link)
$(PROG_FLTHDR): flthdr.o compress.o stubs.o
$(link)
ld-elf2flt$(EXEEXT): ld-elf2flt.o stubs.o
$(link)
ld-elf2flt.sh: $(srcdir)/ld-elf2flt.in
./config.status $@
chmod 755 $@
Makefile: $(srcdir)/Makefile.in
./config.status $@
tests/flthdr/generate: tests/flthdr/generate.o
$(link)
check-flthdr:
mkdir -p tests/flthdr
$(MAKE) tests/flthdr/generate
abs_top_srcdir="$(abs_top_srcdir)" abs_top_builddir="$(abs_top_builddir)" \
$(srcdir)/tests/flthdr/test.sh
check: check-flthdr
clean:
-rm -f $(PROGS) *.$(OBJEXT) .deps
-rm -rf bfd-headers
distclean: clean
-rm -f Makefile config.log config.status config.cache ld-elf2flt
install:
$(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(target_bindir) $(DESTDIR)$(target_libdir)
$(INSTALL) -m 755 $(PROG_FLTHDR) $(DESTDIR)$(bindir)/$(TARGET)-$(PROG_FLTHDR)
$(INSTALL) -m 755 $(PROG_FLTHDR) $(DESTDIR)$(target_bindir)/$(PROG_FLTHDR)
$(INSTALL) -m 755 $(PROG_ELF2FLT) $(DESTDIR)$(bindir)/$(TARGET)-$(PROG_ELF2FLT)
$(INSTALL) -m 755 $(PROG_ELF2FLT) $(DESTDIR)$(target_bindir)/$(PROG_ELF2FLT)
[ -f $(DESTDIR)$(bindir)/$(TARGET)-ld.real$(EXEEXT) ] || \
mv $(DESTDIR)$(bindir)/$(TARGET)-ld$(EXEEXT) $(DESTDIR)$(bindir)/$(TARGET)-ld.real$(EXEEXT)
[ -f $(DESTDIR)$(target_bindir)/ld.real$(EXEEXT) ] || \
mv $(DESTDIR)$(target_bindir)/ld$(EXEEXT) $(DESTDIR)$(target_bindir)/ld.real$(EXEEXT)
$(INSTALL) -m 755 $(PROG_LD_ELF2FLT) $(DESTDIR)$(bindir)/$(TARGET)-ld$(EXEEXT)
$(INSTALL) -m 755 $(PROG_LD_ELF2FLT) $(DESTDIR)$(target_bindir)/ld$(EXEEXT)
$(INSTALL) -m 644 $(SRC_LDFILE) $(DESTDIR)$(target_libdir)/$(LDFILE)
sinclude .deps
.deps: bfd-headers/.stamp
$(CC) -MM $(CPPFLAGS) $(srcdir)/*.c > .deps
# Some versions of binutils may not have all these headers (diagnostics.h
# appeared in binutils 2.31; bfd_stdint.h in 2.32) so some symlinks may be
# dangling.
bfd-headers/.stamp:
rm -rf bfd-headers
mkdir bfd-headers
for f in bfd bfd_stdint; do \
ln -sf $(BFD_INCLUDE_DIR)/$$f.h bfd-headers/$$f.h || exit 1; \
done
for f in ansidecl diagnostics filenames hashtab libiberty symcat; do \
ln -sf $(BINUTILS_INCLUDE_DIR)/$$f.h bfd-headers/$$f.h || exit 1; \
done
ln -sf $(BINUTILS_INCLUDE_DIR)/elf bfd-headers/elf
touch $@