Home | History | Annotate | Download | only in src
      1 ## Process this file with automake to create Makefile.in
      2 ## Configure input file for elfutils.
      3 ##
      4 ## Copyright (C) 1996-2002, 2003, 2004 Red Hat, Inc.
      5 ##
      6 ## This program is Open Source software; you can redistribute it and/or
      7 ## modify it under the terms of the Open Software License version 1.0 as
      8 ## published by the Open Source Initiative.
      9 ##
     10 ## You should have received a copy of the Open Software License along
     11 ## with this program; if not, you may obtain a copy of the Open Software
     12 ## License version 1.0 from http://www.opensource.org/licenses/osl.php or
     13 ## by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
     14 ## 3001 King Ranch Road, Ukiah, CA 95482.
     15 ##
     16 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) \
     17        -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\"
     18 if MUDFLAP
     19 AM_CFLAGS = -Wall -Wshadow -std=gnu99 \
     20 	    $(native_ld_cflags)
     21 else
     22 AM_CFLAGS = -Wall -Wshadow -std=gnu99 \
     23 	    $(if $($(*F)_no_Werror),,-Werror) $(native_ld_cflags)
     24 endif
     25 if MUDFLAP
     26 AM_LDFLAGS = -fmudflap
     27 endif
     28 INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl -I$(srcdir)/../lib -I$(srcdir)/../libdw  -I..
     29 
     30 YACC = @YACC@ -d
     31 AM_YFLAGS = -pld
     32 AM_LFLAGS = -Pld -olex.yy.c
     33 ## Uncomment to enable debugging of linker script parser
     34 ##YYDEBUG = -DYYDEBUG=1
     35 
     36 native_ld = @native_ld@
     37 base_cpu = @base_cpu@
     38 
     39 bin_PROGRAMS = readelf nm size strip ld elflint
     40 
     41 
     42 ld_dsos = libld_elf_i386_pic.a
     43 if NATIVE_LD
     44 noinst_LIBRARIES = libld_elf.a
     45 native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu)
     46 else
     47 noinst_LIBRARIES = libld_elf.a $(ld_dsos)
     48 noinst_PROGRAMS = $(ld_dsos:_pic.a=.so)
     49 endif
     50 
     51 
     52 ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \
     53 	     versionhash.c
     54 
     55 noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \
     56 		 ldscript.h xelf.h unaligned.h
     57 
     58 EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules)
     59 ld_modules = i386_ld.c
     60 
     61 if MUDFLAP
     62 libdw = ../libdw/libdw.a
     63 libelf = ../libelf/libelf.a
     64 else
     65 libdw = ../libdw/libdw.so
     66 libelf = ../libelf/libelf.so
     67 endif
     68 libebl = ../libebl/libebl.a
     69 libeu = ../lib/libeu.a
     70 
     71 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl
     72 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) -ldl
     73 size_LDADD = $(libelf) $(libeu)
     74 strip_LDADD = $(libebl) $(libelf) $(libeu) -ldl
     75 ld_LDADD = $(libebl) $(libelf) $(libeu) -ldl
     76 if NATIVE_LD
     77 ld_LDADD += libld_elf.a
     78 endif
     79 ld_LDFLAGS = -rdynamic
     80 elflint_LDADD  = $(libebl) $(libelf) $(libeu) -ldl
     81 
     82 ldlex.o: ldscript.c
     83 ldlex_no_Werror = yes
     84 ldscript.h: ldscript.c
     85 
     86 # Machine-specific linker code.
     87 libld_elf_a_SOURCES = $(base_cpu)_ld.c
     88 
     89 libld_elf_i386_pic_a_SOURCES =
     90 am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os
     91 
     92 libld_elf_i386_so_SOURCES =
     93 libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map
     94 	$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
     95 	      $(libelf) $(libeu) \
     96 	      -Wl,--version-script,$(srcdir)/libld_elf_i386.map
     97 
     98 
     99 %.os: %.c %.o
    100 	if $(filter-out -fmudflap,$(COMPILE)) -c -o $@ -fpic -DPIC -DSHARED \
    101 	  -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
    102 	  `test -f '$<' || echo '$(srcdir)/'`$<; \
    103 	then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
    104 	     rm -f "$(DEPDIR)/$*.Tpo"; \
    105 	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
    106 	fi
    107 
    108 # Special rule to make it possible to define libld_elf_a_SOURCES as we do.
    109 # Otherwise make would complain.
    110 .deps/none_ld.Po: none_ld.os
    111 	-:
    112 
    113 
    114 installcheck-binPROGRAMS: $(bin_PROGRAMS)
    115 	bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \
    116 	  case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
    117 	   *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
    118 	  esac; \
    119 	  f=`echo "$$p" | \
    120 	     sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
    121 	  for opt in --help --version; do \
    122 	    if LD_LIBRARY_PATH=$(DESTDIR)$(libdir) \
    123 	       $(DESTDIR)$(bindir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \
    124 	         && test -n "`cat c$${pid}_.out`" \
    125 	         && test -z "`cat c$${pid}_.err`"; then :; \
    126 	    else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
    127 	  done; \
    128 	done; rm -f c$${pid}_.???; exit $$bad
    129 
    130 CLEANFILES = none_ld.os $(ld_modules:.c=.os)
    131