OSDN Git Service

This is needed for Blackfin FLAT's to be processed properly, and apparently
[uclinux-h8/elf2flt.git] / Makefile.in
1 srcdir = @srcdir@
2 VPATH = @srcdir@
3 prefix = @prefix@
4 exec_prefix = @exec_prefix@
5
6 bindir = @bindir@
7 libdir = @libdir@
8 includedir = @includedir@
9
10 CC = @CC@
11 CPU = @target_cpu@
12 TARGET = @target_alias@
13 SYMBOL_PREFIX = @SYMBOL_PREFIX@
14 CFLAGS = @CFLAGS@
15 INCLUDES = -I$(srcdir) @bfd_include_dir@ @binutils_include_dir@ @zlib_include_dir@
16 CPPFLAGS = @CPPFLAGS@ $(DEFS) $(INCLUDES)
17 LDFLAGS = @LDFLAGS@
18 LDLIBS = @LIBS@
19 INSTALL = @INSTALL@
20 DEFS = @DEFS@ \
21         -DTARGET_$(CPU) \
22         -DTARGET_CPU=\"$(CPU)\" \
23         -DSYMBOL_PREFIX=\"$(SYMBOL_PREFIX)\" \
24         -DBINUTILS_LDSCRIPTDIR=\"@binutils_ldscript_dir@\" \
25         -DTARGET_ALIAS=\"$(TARGET)\" \
26         -DNO_GOT_CHECK=@got_check@ \
27         -DUSE_EMIT_RELOCS=@emit_relocs@ \
28         -DEMIT_CTOR_DTOR=@emit_ctor_dtor@ \
29         -DALWAYS_RELOC_TEXT=@always_reloc_text@
30 EXEEXT = @EXEEXT@
31 OBJEXT = @OBJEXT@
32
33 HOST = @host_alias@
34
35 ifneq (,$(findstring mingw32,$(HOST)))
36    LDLIBS += -lws2_32
37 endif
38
39 # force link order under cygwin to avoid getopts / libiberty clash
40 ifneq ($(strip $(shell gcc -v 2>&1 | grep "cygwin")),)
41    LDLIBS := -lcygwin $(LDLIBS)
42 endif
43
44 LDFILE= elf2flt.ld
45 ifeq ($(strip $(CPU)),e1)
46 SRC_LDFILE= $(srcdir)/$(CPU)-elf2flt.ld
47 else 
48 SRC_LDFILE= elf2flt.ld
49 endif
50
51 target_bindir = $(prefix)/$(TARGET)/bin
52 target_libdir = $(prefix)/$(TARGET)/lib
53
54
55 PROG_ELF2FLT       = elf2flt$(EXEEXT)
56 PROG_FLTHDR        = flthdr$(EXEEXT)
57 PROG_LD_ELF2FLT_C  = ld-elf2flt$(EXEEXT)
58 PROG_LD_ELF2FLT_SH = ld-elf2flt.sh
59
60 ifeq (@use_ld_elf2flt_binary@,yes)
61 PROG_LD_ELF2FLT    = $(PROG_LD_ELF2FLT_C)
62 else
63 PROG_LD_ELF2FLT    = $(PROG_LD_ELF2FLT_SH)
64 endif
65
66 PROGS = $(PROG_ELF2FLT) $(PROG_FLTHDR) $(PROG_LD_ELF2FLT_C) $(PROG_LD_ELF2FLT_SH)
67
68 all: $(PROGS)
69
70 # We need to declare the link explicitly because make only provides
71 # implicit rules when EXEEXT is set to nothing
72 link = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
73
74 $(PROG_ELF2FLT): elf2flt.o compress.o stubs.o
75         $(link)
76
77 $(PROG_FLTHDR): flthdr.o compress.o stubs.o
78         $(link)
79
80 ld-elf2flt$(EXEEXT): ld-elf2flt.o stubs.o
81         $(link)
82
83 ld-elf2flt.sh: $(srcdir)/ld-elf2flt.in
84         ./config.status $@
85         chmod 755 $@
86
87 Makefile: $(srcdir)/Makefile.in
88         ./config.status $@
89
90 clean:
91         -rm -f $(PROGS) *.$(OBJEXT) .deps
92
93 distclean: clean
94         -rm -f Makefile config.log config.status config.cache ld-elf2flt
95
96 install:
97         $(INSTALL) -d $(bindir)
98         $(INSTALL) -d $(target_bindir)
99         $(INSTALL) -d $(target_libdir)
100         $(INSTALL) -m 755 $(PROG_FLTHDR) $(bindir)/$(TARGET)-$(PROG_FLTHDR)
101         $(INSTALL) -m 755 $(PROG_FLTHDR) $(target_bindir)/$(PROG_FLTHDR)
102         $(INSTALL) -m 755 $(PROG_ELF2FLT) $(bindir)/$(TARGET)-$(PROG_ELF2FLT)
103         $(INSTALL) -m 755 $(PROG_ELF2FLT) $(target_bindir)/$(PROG_ELF2FLT)
104         [ -f $(bindir)/$(TARGET)-ld.real$(EXEEXT) ] || \
105                 mv $(bindir)/$(TARGET)-ld$(EXEEXT) $(bindir)/$(TARGET)-ld.real$(EXEEXT)
106         [ -f $(target_bindir)/ld.real$(EXEEXT) ] || \
107                 mv $(target_bindir)/ld$(EXEEXT) $(target_bindir)/ld.real$(EXEEXT)
108         $(INSTALL) -m 755 $(PROG_LD_ELF2FLT) $(bindir)/$(TARGET)-ld$(EXEEXT)
109         $(INSTALL) -m 755 $(PROG_LD_ELF2FLT) $(target_bindir)/ld$(EXEEXT)
110         $(INSTALL) -m 644 $(SRC_LDFILE) $(target_libdir)/$(LDFILE)
111
112 sinclude .deps
113 .deps:
114         $(CC) -MM $(CPPFLAGS) $(srcdir)/*.c > .deps