aboutsummaryrefslogtreecommitdiff
path: root/ld/Makefile.in
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1992-02-15 23:13:00 +0000
committerPer Bothner <per@bothner.com>1992-02-15 23:13:00 +0000
commit7e5c1057bb33fb6be25ada95ba7f58066d88de80 (patch)
tree7c9c733b223dcb3ab608e93fd9c0f13afffee7ff /ld/Makefile.in
parent15c5ec2e272c81d2358a96a21dd9cd038f18d61b (diff)
downloadgdb-7e5c1057bb33fb6be25ada95ba7f58066d88de80.zip
gdb-7e5c1057bb33fb6be25ada95ba7f58066d88de80.tar.gz
gdb-7e5c1057bb33fb6be25ada95ba7f58066d88de80.tar.bz2
* Makefile.in: Major changes. Removed some the sed
magic to converts scripts, since that is now handled by genscripts.sh and the *.sc-sh scipt generators. * config.h: Remove a bunch of macros defining emulations and targets. This becomes one less file to edit when adding emulations or targets. * ldemul.h (struct ld_emulation_xfer_struct): Add emulation_name and target_name fields. * ldemul.c, ldemul.h: Define some default functions used by most emulations (and remove from the *.em scripts). * ldemul.c (ldemul_choose_target): Search the new ld_emulations array using a loop (instead of a hardwired nested if statement). Define the ld_emulation from the automatically-geenrated ldemul-list.h. This means you no longer have to edit ldemul.c to add a new emulation. * ldmain.c: Replace {GLD,LNK}960_EMULATION_NAME by their expansions, since the former no longer exist. * PORTING: A very rough first draft of a porting guide.
Diffstat (limited to 'ld/Makefile.in')
-rw-r--r--ld/Makefile.in242
1 files changed, 79 insertions, 163 deletions
diff --git a/ld/Makefile.in b/ld/Makefile.in
index c4ff521..411b981 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -80,11 +80,7 @@ TEXI2ROFF=texi2roff
# Which roff program to use to generate index for texi2roff'd doc
ROFF = groff
-SCRIPTS = ldgld68k.sc ldgld.sc \
- ldlnk960.sc ldlnk960r.sc ldgld960.sc \
- i386aout.sc ldm88k.sc ldglda29k.sc news.sc h8300hds.sc ebmon29k.sc
-
-#### Host, target, and site specific Makefile fragments come in here.
+### Host, target, and site specific Makefile fragments come in here.
###
CFLAGS = $(INCLUDES) $(MINUS_G) $(HDEFINES) $(TDEFINES) $(CDEFINES)
@@ -97,75 +93,20 @@ LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
# install.
LD_PROG = ld.new
-# A .sc script file is needed for each emulation mode.
-# sed is used to transform this script into two variant forms:
-# A .scr script is for linking without relocation (-r flag).
-# A .scu script is like .scr, but *do* create constructors.
-# A .scn script is for linking with -N flag (mix text and data on same page).
-# A .scN script is for linking with -N flag (mix text and data on same page).
-# The diference is that segments should (need) not be page aligned.
-
-# A sed pattern to translate .sc to .scu:
-SED_MAKE_RELOC_WITH_CONSTRUCTORS=\
- -e "/If relocating/,/End if relocating/d" \
- -e "/=/s/[_a-zA-Z.]* *= .*//g" \
- -e '/>/s/} *> *[a-zA-Z]*/}/' \
- -e "/text/s/[.]text .*:/.text :/" \
- -e "/data/s/[.]data .*:/.data :/"
-# A sed pattern to translate .scu to .scr:
-SED_REMOVE_CONSTRUCTORS= -e /CONSTRUCTORS/d
-
-.sc.scu:
- sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) $< >$*.scu
-.scu.scr:
- sed $(SED_REMOVE_CONSTRUCTORS) < $< >$*.scr
-
-# Each builtin script file is included as a C string literal.
-# These are generated by the mkscript filter.
-.sc.x:
- if [ "x"$(LIB_PATH) = "x" ]; then ./mkscript < $< >$*.x ; \
- else \
- (sed <$< -e '/SEARCH_DIR(.*)/d' ; \
- echo $(LIB_PATH) | tr ':' ' ' | sed -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\1);/g';) | ./mkscript >$*.x;\
- fi
-
-# The .xn script is used if the -n flag is given (write-protect text)..
-# Sunos starts the text segment for demand-paged binaries at 0x2020
-# and other binaries at 0x2000, since the exec header is paged in
-# with the text. Some other Unix variants do the same.
-# For -n and -N flags the offset of the exec header must be removed.
-# This sed script does this if the master script contains
-# a line of the form ".text 0xAAAA BLOCK(0xBBBB):" - the
-# output will contain ".text 0xBBBB:". (For Sunos AAAA=2020 and BBBB=2000.)
-.x.xn:
- sed -e '/text/s/\.text .* BLOCK(\([^)]*\)):/.text \1:/' < $< >$*.xn
-
-# The .xN script is used if the -N flag is given (don't write-protect text).
-# This is like -n, except that the data segment need not be page-aligned.
-# So get rid of commands for page-alignment: We assume these use ALIGN
-# with a hex constant that end with 00, since any normal page size is be
-# at least divisible by 256. We use the 00 to avoid matching
-# anything that tries to align of (say) 8-byte boundaries.
-.xn.xN:
- sed -e '/ALIGN/s/ALIGN( *0x[0-9a-fA-F]*00 *)/./' < $< >$*.xN
-
-# The xu and xr scripts don't search libraries, so LIB_PATH doesn't matter.
-.sc.xu:
- sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) < $< | ./mkscript >$*.xu
-.sc.xr:
- sed $(SED_MAKE_RELOC_WITH_CONSTRUCTORS) $(SED_REMOVE_CONSTRUCTORS) \
- < $< | ./mkscript >$*.xr
-
# for self hosting
BFDLIB=$(unsubdir)/../bfd$(subdir)/libbfd.a
LIBIBERTY=$(unsubdir)/../libiberty$(subdir)/libiberty.a
+ALL_EMULATIONS=ld__lnk960.o ld__sun3.o ld__i386aout.o \
+ ld__m88kbcs.o ld__a29k.o ld__news.o ld__h8300hms.o ld__ebmon29k.o \
+ ld__sun4.o ld__gld960.o ld__vanilla.o
+
+EMULATION_OFILES=${ALL_EMULATIONS}
+#EMULATION_OFILES=ld__${EMUL}.o ${OTHER_EMULATIONS}
+
OFILES= ldgram.o ldlex.o lexsup.o ldlang.o ldctor.o ldmain.o ldindr.o \
- ldwarn.o ldwrite.o ldexp.o ldlnk960.o ld__gld68k.o ld__i386aout.o \
- ld__m88k.o ld__glda29k.o ld__news.o h8300hds.o ld__ebmon29k.o \
- ld__gld.o ldgld960.o ldemul.o ldver.o ldmisc.o ldsym.o \
- ldvanilla.o ldfile.o \
- relax.o lderror.o
+ ldwarn.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldsym.o \
+ ldfile.o relax.o lderror.o ${EMULATION_OFILES}
HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h \
ldsym.h ldctor.h ldlang.h ldexp.h \
@@ -174,12 +115,12 @@ HEADERS=config.h ldmain.h ldmain.h ldwarn.h ldmisc.h ldindr.h \
MANSOURCES=ld.tex
LDCSOURCES=ldlang.c lexsup.c ldctor.c ldindr.c ldmain.c ldwrite.c ldwarn.c ldlnk960.c \
- ld__gld.c ld__gld68k.c ld__m88k.c ld__ebmon29k.c \
+ ld__gld.c ld__sun3.c ld__m88k.c ld__ebmon29k.c \
ldgld960.c ldemul.c ldver.c ldmisc.c ldexp.c ldsym.c ldfile.c \
- ldvanilla.c relax.c lderror.c
+ relax.c lderror.c
-GENERATED_SOURCES=ldgram.c ldlex.c ldgram.h ld__*.c
-GENERATED_HEADERS=ldgram.h
+GENERATED_SOURCES=ldgram.c ldlex.c ld__*.c ldemul-list.h
+GENERATED_HEADERS=ldgram.h ldemul-list.h
LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l ldgram.h
@@ -188,7 +129,7 @@ BFDSOURCES=../../bfd/common/*.c
SOURCES= $(LDSOURCES) $(BFDSOURCES)
LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
-STAGESTUFF = *.x *.x[ru] *.sc[ru] $(GENERATED_SOURCES) $(GENERATED_HEADERS) $(OFILES) $(LD_PROG) mkscript
+STAGESTUFF = *.x *.x[runN] *.sc[runN] $(GENERATED_SOURCES) $(GENERATED_HEADERS) $(OFILES) $(LD_PROG) mkscript
all: Makefile $(LD_PROG)
@@ -200,7 +141,23 @@ ldgram.h ldgram.c: ldgram.y
mv -f y.tab.h ldgram.h
ldmain.o: ldmain.c
- $(CC) $(CFLAGS) -DDEFAULT_EMULATION=$(EMUL) -c $<
+ $(CC) $(CFLAGS) -DDEFAULT_EMULATION='"$(EMUL)"' -c $<
+
+ldemul-list.h: Makefile
+ (echo "/* This file is automatically generated. DO NOT EDIT! */";\
+ for f in `echo " " ${EMULATION_OFILES} "" \
+ | sed -e 's/ld__/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
+ echo "extern ld_emulation_xfer_type ld_$${f}_emulation;"; \
+ done;\
+ echo "";\
+ echo "#define EMULATION_LIST \\";\
+ for f in `echo " " ${EMULATION_OFILES} "" \
+ | sed -e 's/ld__/ld/g' -e 's/ ld/ /g' -e 's/[.]o//g'`; do \
+ echo " &ld_$${f}_emulation, \\"; \
+ done;\
+ echo " 0") >ldemul-list.h
+
+ldemul.o: ldemul-list.h
ldlex.c: ldlex.l
/lib/cpp -E -P $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CDEFINES) $(VPATH)/ldlex.l >ldlex.p
@@ -213,67 +170,55 @@ ldlex.c: ldlex.l
# These all start with ld__ so 'make clean' can find them.
-ld__gld.c: $(srcdir)/ldtemplate
- sed -e s/"<ldtarget>"/ldgld/g -e s/"<arch>"/m68k/g \
- -e s/"<target>"//g -e s/"<TARGET>"//g <$(srcdir)/ldtemplate >$@
-ld__news.c: $(srcdir)/ldtemplate
- sed -e s/"<ldtarget>"/news/g -e s/"<arch>"/m68k/g \
- -e s/"<target>"/news/g -e s/"<TARGET>"/NEWS/g <$(srcdir)/ldtemplate >$@
-
-ld__i386aout.c: $(srcdir)/ldtemplate
- sed -e s/"<ldtarget>"/i386aout/g -e s/"<arch>"/i386/g \
- -e s/"<target>"/i386aout/g -e s/"<TARGET>"/I386AOUT/g <$(srcdir)/ldtemplate >$@
-
-
-ld__ebmon29k.c: $(srcdir)/ldtemplate
- sed -e s/"<ldtarget>"/ebmon29k/g -e s/"<arch>"/a29k/g \
- -e s/"gld<target>"/ebmon29k/g -e s/"GLD<TARGET>"/EBMON29K/g \
- -e s/"<ldtarget>.x"/ebmon.x/ <$(srcdir)/ldtemplate >$@
-
-ld__gld68k.c: $(srcdir)/ldtemplate
- sed -e s/"<ldtarget>"/ldgld68k/g -e s/"<arch>"/m68k/g \
- -e s/"<target>"/68k/g -e s/"<TARGET>"/68K/g <$(srcdir)/ldtemplate >$@
-ld__glda29k.c: $(srcdir)/ldtemplate
- sed -e s/"<ldtarget>"/ldglda29k/g -e s/"<arch>"/a29k/g \
- -e s/"<target>"/29k/g -e s/"<TARGET>"/29K/g <$(srcdir)/ldtemplate >$@
-ld__m88k.c: $(srcdir)/ldtemplate
- sed -e s/"<ldtarget>"/ldm88k/g -e s/"<arch>"/m88k/g \
- -e s/"<target>"/m88kbcs/g -e s/"<TARGET>"/M88KBCS/g <$(srcdir)/ldtemplate >$@
-
-# The .c files for these are generated from ldtemplete.
-ld__gld.o: ./mkscript ldgld.x ldgld.xr ldgld.xu ldgld.xn ldgld.xN
-ld__news.o: ./mkscript news.x news.xr news.xu news.xn news.xN
-ld__i386aout.o: ./mkscript i386aout.x i386aout.xr i386aout.xu i386aout.xn i386aout.xN
-ld__ebmon29k.o: ./mkscript ebmon29k.x ebmon29k.xr ebmon29k.xu \
- ebmon29k.xn ebmon29k.xN
-ld__gld68k.o: ./mkscript ldgld68k.x ldgld68k.xr ldgld68k.xu \
- ldgld68k.xn ldgld68k.xN
-ld__glda29k.o: ./mkscript ldglda29k.x ldglda29k.xr ldglda29k.xu \
- ldglda29k.xn ldglda29k.xN
-ld__m88k.o: ./mkscript ldm88k.x ldm88k.xr ldm88k.xu ldm88k.xn ldm88k.xN
-
-# The .c files for these are (for now) specially written (not ldtemplete).
-ldgld960.o: ./mkscript ldgld960.x
-ldlnk960.o: ./mkscript ldlnk960.x ldlnk960.xr
-h8300hds.o: ./mkscript h8300hds.x
-
-
-#$(BFDLIB): $(BFDSOURCES)
-# (cd ../bfd; make)
+GENSCRIPTS=sh $(srcdir)/genscripts.sh ${srcdir} ${host_alias} ${target_alias}
+GEN_DEPENDS=./mkscript $(srcdir)/genscripts.sh
+
+ld__sun4.c: $(srcdir)/sun4.sh \
+ $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
+ ${GENSCRIPTS} sun4.sh
+ld__sun3.c: $(srcdir)/sun3.sh \
+ $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
+ ${GENSCRIPTS} sun3.sh
+ld__news.c: $(srcdir)/news.sh \
+ $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
+ ${GENSCRIPTS} news.sh
+ld__i386aout.c: $(srcdir)/i386aout.sh \
+ $(srcdir)/generic.em $(srcdir)/aout.sc-sh ${GEN_DEPENDS}
+ ${GENSCRIPTS} i386aout.sh
+ld__ebmon29k.c: $(srcdir)/ebmon29k.sh \
+ $(srcdir)/generic.em $(srcdir)/ebmon29k.sc-sh ${GEN_DEPENDS}
+ ${GENSCRIPTS} ebmon29k.sh
+ld__a29k.c: $(srcdir)/a29k.sh \
+ $(srcdir)/generic.em $(srcdir)/a29k.sc-sh ${GEN_DEPENDS}
+ ${GENSCRIPTS} a29k.sh
+ld__m88kbcs.c: $(srcdir)/m88kbcs.sh \
+ $(srcdir)/generic.em $(srcdir)/h8300hms.sc-sh ${GEN_DEPENDS}
+ ${GENSCRIPTS} m88kbcs.sh
+ld__h8300hms.c: $(srcdir)/h8300hms.sh \
+ $(srcdir)/h8300hms.em $(srcdir)/h8300hms.sc-sh ${GEN_DEPENDS}
+ ${GENSCRIPTS} h8300hms.sh
+ld__vanilla.c: $(srcdir)/vanilla.sh \
+ $(srcdir)/vanilla.em $(srcdir)/vanilla.sc-sh ${GEN_DEPENDS}
+ ${GENSCRIPTS} vanilla.sh
+ld__lnk960.c: $(srcdir)/lnk960.sh \
+ $(srcdir)/lnk960.em $(srcdir)/i960.sc-sh ${GEN_DEPENDS}
+ ${GENSCRIPTS} lnk960.sh
+ld__gld960.c: $(srcdir)/gld960.sh \
+ $(srcdir)/gld960.em $(srcdir)/i960.sc-sh ${GEN_DEPENDS}
+ ${GENSCRIPTS} gld960.sh
$(LD_PROG): $(OFILES) $(BFDLIB) $(LIBIBERTY)
$(CC) $(CFLAGS) $(LDFLAGS) -o $(LD_PROG) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(LOADLIBES)
-# (cd ../bfd; make)
-# LDEMULATION=gld; export LDEMULATION; GNUTARGET=a.out-sunos-big;./ldok -format a.out-sunos-big -o ld /lib/crt0.o $(OFILES) $(BFDLIB) $(LIBIBERTY) -lc /usr/local/lib/gcc/sparc/1.91/gnulib
-# gld -o ld /lib/crt0.o $(OFILES) $(BFDLIB) $(LIBIBERTY) -lc /usr/local/lib/gcc/sparc/1.91/gnulib
-# $(CC) -Bstatic -o ld.new $(OFILES) $(BFDLIB) $(LIBIBERTY)
-
+# Rules for testing by relinking ld itself.
-ld1: ld.new
- $(HOSTING_EMU); ./ld.new -o foo.o -r $(OFILES)
- $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) foo.o $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+ld-partial.o: ld.new
+ $(HOSTING_EMU); ./ld.new -o ld-partial.o -r $(OFILES)
+ld1: ld-partial.o
+ $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) ld-partial.o $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
+ld1-full: ld.new
+ $(HOSTING_EMU); ./ld.new -o ld1-full $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
ld2: ld1
$(HOSTING_EMU); ./ld1 -o ld2 $(HOSTING_CRT0) $(OFILES) $(BFDLIB) $(LIBIBERTY) $(HOSTING_LIBS)
@@ -381,32 +326,7 @@ ldlex.o: ldlex.c ldgram.h
ldgram.o: ldgram.c
ldgram.c:ldgram.y
-ldgld68k.x :ldgld68k.sc
-ldgld68kUr.x :ldgld68kUr.sc
-ldgld68kr.x :ldgld68kr.sc
-h8300hds.x:h8300hds.sc
-ldgld.x :ldgld.sc
-ldgldUr.x :ldgldUr.sc
-ldgldr.x :ldgldr.sc
-ldlnk960.x :ldlnk960.sc
-ldlnk960r.x :ldlnk960r.sc
-ldgld960.x :ldgld960.sc
-ldgldm88k.x :ldgldm88k.sc
-ldm88kUr.x :ldm88kUr.sc
-ldm88kr.x:ldm88kr.sc
-ldm88k.x:ldm88k.sc
-news.x:news.sc
-i386aout.x:i386aout.sc
-h8300hds.x:h8300hds.sc
-h8300hds.o:h8300hds.c
-ldgld68k.x:ldgld68k.sc
-ldglda29k.x :ldglda29k.sc
-ldglda29kr.x :ldglda29kr.sc
-ldglda29kUr.x :ldglda29kUr.sc
-
-ebmon29k.x :ebmon29k.sc
-ebmon29kr.x :ebmon29kr.sc
-ebmon29kUr.x :ebmon29kUr.sc
+h8300hms.o:h8300hms.c
stage1: force
-mkdir stage1
@@ -444,10 +364,9 @@ de-stage3: force
-rmdir stage3
clean:
- -rm -f TAGS $(OFILES) $(GENERATED_SOURCES) $(GENERATED_HEADERS)
- -rm -f *.x *.x[runN] *.sc[runN]
- -rm -f ld.?? ld.???
- -rm -f ld ld1 ld2 ld3 ld.new mkscript *.o y.output
+ -rm -f TAGS $(STAGESTUFF)
+ -rm -f ld.?? ld.??? ldlex.[qp]
+ -rm -f ld ld1 ld2 ld3 *.o y.output
lintlog:$(SOURCES) Makefile
$(LINT) -abhxzn $(LINTFLAGS) $(LINTSOURCES) \
@@ -469,9 +388,6 @@ objdump:objdump.c
install: $(LD_PROG)
$(INSTALL_PROGRAM) ld.new $(bindir)/ld
- -if [ -d "$(gcclibdir)" ] ; then \
- $(INSTALL_PROGRAM) ld.new $(gcclibdir)/ld ; \
- fi
install-info: info
for i in ld.info* ; do \