OSDN Git Service

when debugging a flat loader problem involving relocs, i found it very
[uclinux-h8/elf2flt.git] / Makefile.in
index 4f54438..f041890 100644 (file)
@@ -11,15 +11,26 @@ CC = @CC@
 CPU = @target_cpu@
 TARGET = @target_alias@
 CFLAGS = @CFLAGS@
-INCLUDES = @bfd_include_dir@ @binutils_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
@@ -39,11 +50,14 @@ PROGS = $(PROG_ELF2FLT) $(PROG_FLTHDR)
 
 all: $(PROGS)
 
-$(PROG_ELF2FLT): elf2flt.c stubs.c Makefile
-       $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $(srcdir)/elf2flt.c $(srcdir)/stubs.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)
 
-$(PROG_FLTHDR): flthdr.c Makefile
-       $(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $(srcdir)/flthdr.c $(LIBS)
+Makefile: $(srcdir)/Makefile.in
+       ./config.status $@
 
 clean:
        -rm -f $(PROGS) *.$(OBJEXT)
@@ -52,10 +66,13 @@ distclean: clean
        -rm -f Makefile config.log config.status config.cache ld-elf2flt
 
 install:
-       $(INSTALL) -s -m 755 $(PROG_FLTHDR) $(bindir)/$(TARGET)-$(PROG_FLTHDR)
-       $(INSTALL) -s -m 755 $(PROG_FLTHDR) $(target_bindir)/$(PROG_FLTHDR)
-       $(INSTALL) -s -m 755 $(PROG_ELF2FLT) $(bindir)/$(TARGET)-$(PROG_ELF2FLT)
-       $(INSTALL) -s -m 755 $(PROG_ELF2FLT) $(target_bindir)/$(PROG_ELF2FLT)
+       $(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) ] || \