OSDN Git Service

We renamed all the Blackfin relocs in the toolchain to match other ports
[uclinux-h8/elf2flt.git] / Makefile.in
index 89a7f7c..1b192c4 100644 (file)
@@ -11,45 +11,77 @@ CC = @CC@
 CPU = @target_cpu@
 TARGET = @target_alias@
 CFLAGS = @CFLAGS@
-INCLUDES = @bfd_include_dir@
+INCLUDES = @bfd_include_dir@ @binutils_include_dir@ @zlib_include_dir@
 CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@ -static
+LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
 INSTALL = @INSTALL@
 DEFS = @DEFS@ -DTARGET_$(CPU)
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
+
+HOST = @host_alias@
+
+ifneq (,$(findstring mingw32,$(HOST)))
+   LIBS :=  $(LIBS) -lws2_32
+endif
+
+# force link order under cygwin to avoid getopts / libiberty clash
+ifneq ($(strip $(shell gcc -v 2>&1 | grep "cygwin")),)
+   LIBS := -lcygwin $(LIBS)
+endif
 
 CCFLAGS = $(CFLAGS) $(DEFS) $(INCLUDES)
 
+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
 
-PROGS = elf2flt flthdr
 
-all: $(PROGS)
+PROG_ELF2FLT = elf2flt$(EXEEXT)
+PROG_FLTHDR = flthdr$(EXEEXT)
+PROGS = $(PROG_ELF2FLT) $(PROG_FLTHDR)
 
-elf2flt: $(srcdir)/elf2flt.c Makefile
-       $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $(srcdir)/elf2flt.c $(LIBS)
+all: $(PROGS) ld-elf2flt
 
-flthdr: $(srcdir)/flthdr.c Makefile
-       $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $(srcdir)/flthdr.c $(LIBS)
+$(PROG_ELF2FLT): $(srcdir)/elf2flt.c compress.o $(srcdir)/stubs.c
+       $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+$(PROG_FLTHDR): $(srcdir)/flthdr.c compress.o
+       $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+ld-elf2flt: $(srcdir)/ld-elf2flt.in
+       ./config.status $@
+
+Makefile: $(srcdir)/Makefile.in
+       ./config.status $@
 
 clean:
-       -rm -f $(PROGS) *.[oa]
+       -rm -f $(PROGS) *.$(OBJEXT)
 
 distclean: clean
-       -rm -f Makefile config.log config.status config.cache
+       -rm -f Makefile config.log config.status config.cache ld-elf2flt
 
 install:
-       $(INSTALL) -s -m 755 flthdr $(bindir)/$(TARGET)-flthdr
-       $(INSTALL) -s -m 755 flthdr $(target_bindir)/flthdr
-       $(INSTALL) -s -m 755 elf2flt $(bindir)/$(TARGET)-elf2flt
-       $(INSTALL) -s -m 755 elf2flt $(target_bindir)/elf2flt
-       [ -f $(bindir)/$(TARGET)-ld.real ] || \
-               mv $(bindir)/$(TARGET)-ld $(bindir)/$(TARGET)-ld.real
-       [ -f $(target_bindir)/ld.real ] || \
-               mv $(target_bindir)/ld $(target_bindir)/ld.real
-       $(INSTALL) -m 755 $(srcdir)/ld-elf2flt $(bindir)/$(TARGET)-ld
-       $(INSTALL) -m 755 $(srcdir)/ld-elf2flt $(target_bindir)/ld
-       $(INSTALL) -m 644 $(srcdir)/elf2flt.ld $(target_libdir)
-       $(INSTALL) -m 644 $(srcdir)/elf2flt.movdat.ld $(target_libdir)
+       $(INSTALL) -d $(bindir)
+       $(INSTALL) -d $(target_bindir)
+       $(INSTALL) -d $(target_libdir)
+       $(INSTALL) -m 755 $(PROG_FLTHDR) $(bindir)/$(TARGET)-$(PROG_FLTHDR)
+       $(INSTALL) -m 755 $(PROG_FLTHDR) $(target_bindir)/$(PROG_FLTHDR)
+       $(INSTALL) -m 755 $(PROG_ELF2FLT) $(bindir)/$(TARGET)-$(PROG_ELF2FLT)
+       $(INSTALL) -m 755 $(PROG_ELF2FLT) $(target_bindir)/$(PROG_ELF2FLT)
+       [ -f $(bindir)/$(TARGET)-ld.real$(EXEEXT) ] || \
+               mv $(bindir)/$(TARGET)-ld$(EXEEXT) $(bindir)/$(TARGET)-ld.real$(EXEEXT)
+       [ -f $(target_bindir)/ld.real$(EXEEXT) ] || \
+               mv $(target_bindir)/ld$(EXEEXT) $(target_bindir)/ld.real$(EXEEXT)
+       $(INSTALL) -m 755 ld-elf2flt $(bindir)/$(TARGET)-ld
+       $(INSTALL) -m 755 ld-elf2flt $(target_bindir)/ld
+       $(INSTALL) -m 644 $(SRC_LDFILE) $(target_libdir)/$(LDFILE)
+