OSDN Git Service

nios/nios2 support by Wentao Xu <wentao@microtronix.com>
[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 CFLAGS = @CFLAGS@
14 INCLUDES = @bfd_include_dir@ @binutils_include_dir@
15 CPPFLAGS = @CPPFLAGS@
16 LDFLAGS = @LDFLAGS@ -static
17 LIBS = @LIBS@
18 INSTALL = @INSTALL@
19 DEFS = @DEFS@ -DTARGET_$(CPU)
20 EXEEXT = @EXEEXT@
21 OBJEXT = @OBJEXT@
22
23 UNAME := $(shell uname -s)
24
25 ifneq (,$(findstring MINGW,$(UNAME)))
26    LIBS :=  $(LIBS) -lws2_32
27 endif
28
29 # force link order under cygwin to avoid getopts / libiberty clash
30 ifneq ($(strip $(shell gcc -v 2>&1 | grep "cygwin")),)
31    LIBS := -lcygwin $(LIBS)
32 endif
33
34 CCFLAGS = $(CFLAGS) $(DEFS) $(INCLUDES)
35
36 LDFILE= elf2flt.ld
37 ifeq ($(strip $(CPU)),e1)
38 SRC_LDFILE= $(CPU)-elf2flt.ld
39 else 
40 SRC_LDFILE= elf2flt.ld
41 endif
42
43 target_bindir = $(prefix)/$(TARGET)/bin
44 target_libdir = $(prefix)/$(TARGET)/lib
45
46
47 PROG_ELF2FLT = elf2flt$(EXEEXT)
48 PROG_FLTHDR = flthdr$(EXEEXT)
49 PROGS = $(PROG_ELF2FLT) $(PROG_FLTHDR)
50
51 all: $(PROGS)
52
53 $(PROG_ELF2FLT): elf2flt.c stubs.c Makefile
54         $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $(srcdir)/elf2flt.c $(srcdir)/stubs.c $(LIBS)
55
56 $(PROG_FLTHDR): flthdr.c Makefile
57         $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $(srcdir)/flthdr.c $(LIBS)
58
59 clean:
60         -rm -f $(PROGS) *.$(OBJEXT)
61
62 distclean: clean
63         -rm -f Makefile config.log config.status config.cache ld-elf2flt
64
65 install:
66         $(INSTALL) -d $(bindir)
67         $(INSTALL) -d $(target_bindir)
68         $(INSTALL) -d $(target_libdir)
69         $(INSTALL) -s -m 755 $(PROG_FLTHDR) $(bindir)/$(TARGET)-$(PROG_FLTHDR)
70         $(INSTALL) -s -m 755 $(PROG_FLTHDR) $(target_bindir)/$(PROG_FLTHDR)
71         $(INSTALL) -s -m 755 $(PROG_ELF2FLT) $(bindir)/$(TARGET)-$(PROG_ELF2FLT)
72         $(INSTALL) -s -m 755 $(PROG_ELF2FLT) $(target_bindir)/$(PROG_ELF2FLT)
73         [ -f $(bindir)/$(TARGET)-ld.real$(EXEEXT) ] || \
74                 mv $(bindir)/$(TARGET)-ld$(EXEEXT) $(bindir)/$(TARGET)-ld.real$(EXEEXT)
75         [ -f $(target_bindir)/ld.real$(EXEEXT) ] || \
76                 mv $(target_bindir)/ld$(EXEEXT) $(target_bindir)/ld.real$(EXEEXT)
77         $(INSTALL) -m 755 ld-elf2flt $(bindir)/$(TARGET)-ld
78         $(INSTALL) -m 755 ld-elf2flt $(target_bindir)/ld
79         $(INSTALL) -m 644 $(srcdir)/$(SRC_LDFILE) $(target_libdir)/$(LDFILE)
80
81