CFLAGS = $(INCLUDES) $(EXTRA_DEF) $(DEBUG) $(CDEFINES)
LINTFLAGS = $(INCLUDES) $(EXTRA_DEF)
-.SUFFIXES: .y
+.SUFFIXES: .y .x .script $(SUFFIXES)
.y.o:
- yacc -tvd $<
+ $(YACC) $<
mv y.tab.c ldgram.tab.c
$(CC) -c $(CFLAGS) ldgram.tab.c
mv ldgram.tab.o ldgram.o
+
+
# go directly to ld.new in case this ld isn't capable of
# linking native object on this host. It can be renamed on
# install.
-PROGS = $(HOSTDIR)/ld.new
+PROGS = $(HOSTDIR)/ld.new
+MKSCRIPT = $(HOSTDIR)/mkscript
+
+.script.x:
+ mkscript < $< >$*.x
# for self hosting
GNUTARGET=a.out-generic-big
BFDLIB=$(srcdir)/../bfd$(subdir)/libbfd.a
OBJS= ldgram.o ldlex.o ldlang.o ldmain.o ldwrite.o ldexp.o ld-lnk960.o ld-gld68k.o \
- ld-gld.o ld-gld960.o ld-emul.o ldversion.o ldmisc.o ldsym.o ldfile.o
+ ld-gld.o ld-gld960.o ld-emul.o ldversion.o ldmisc.o ldsym.o ld-vanilla.o ldfile.o
HEADERS=config.h ldmain.h ldmain.h ldmisc.h ldsym.h ldlang.h ldexp.h \
ldlex.h ldwrite.h ldversion.h ld-emul.h ldfile.h ldgram.h ld.h
MANSOURCES=ld.tex
LDCSOURCES=ldlang.c ldmain.c ldwrite.c ld-lnk960.c ld-gld.c ld-gld68k.c \
- ld-gld960.c ld-emul.c ldversion.c ldmisc.c ldexp.c ldsym.c ldfile.c
+ ld-gld960.c ld-emul.c ldversion.c ldmisc.c ldexp.c ldsym.c ldfile.c ld-vanilla.c
GENERATED_SOURCES=ldgram.tab.c ldlex.c ldgram.tab.h y.tab.h
GENERATED_HEADERS=ldgram.tab.h
SOURCES= $(LDSOURCES) $(BFDSOURCES)
LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES)
-all: Makefile $(PROGS)
+all: Makefile mkscript $(PROGS)
+
+
$(CC) -Bstatic -o ld.new $(OBJS) $(BFDLIB)
-ld1: ld
- gcc -v -B./ -o ld1 $(OBJS) $(BFDLIB)
+ld1: ld.new
+ $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) $(OBJS) $(BFDLIB) $(HOSTING_LIBS)
ld2: ld1
- mv ld1 ld
- gcc -v -B./ -o ld2 $(OBJS) $(BFDLIB)
+ $(HOSTING_EMU); ./ld1 -o ld2 $(HOSTING_CRT0) $(OBJS) $(BFDLIB) $(HOSTING_LIBS)
ld3: ld2
- mv ld2 ld
- gcc -v -B./ -o ld3 $(OBJS) $(BFDLIB)
+ $(HOSTING_EMU); ./ld2 -o ld3 $(HOSTING_CRT0) $(OBJS) $(BFDLIB) $(HOSTING_LIBS)
ld.dvi:ld.tex
tex ld.tex
+
+SCRIPTS=ld-gld68k.script ld-gld68k-Ur.script ld-gld68k-r.script ld-gld.script ld-gld-Ur.script ld-gld-r.script ld-lnk960.script ld-lnk960-r.script ld-gld960.script
+PROCESSED_SCRIPTS=ld-gld68k.x ld-gld68k-Ur.x ld-gld68k-r.x ld-gld.x ld-gld-Ur.x ld-gld-r.x ld-lnk960.x ld-lnk960-r.x ld-gld960.x
+
+
+$(MKSCRIPT):mkscript.c $(SCRIPTS)
+
+
+
ldgram.o: ldgram.y
ldgram.tab.h:ldgram.y
cp y.tab.h ldgram.tab.h
+
+ld-gld.o: $(PROCESSED_SCRIPTS) ld-gld.c
+
ldlex.c: ldlex.l ldgram.tab.h
ldlex.o: ldlex.c ldgram.tab.h
ldfile.o: ldfile.c
ldwrite.o: ldwrite.c
ldlang.o: ldlang.c ldgram.tab.h
-ld-gld.o: ld-gld.c
-ld-gld68k.o: ld-gld68k.c
-ld-gld960.o: ld-gld960.c
+
+ld-gld68k.o: $(PROCESSED_SCRIPTS) ld-gld68k.c
+ld-gld960.o: $(PROCESSED_SCRIPTS) ld-gld960.c
ld-emul.o: ld-emul.c
-ld-lnk960.o: ld-lnk960.c
+ld-vanilla.o: ld-vanilla.c
+ld-lnk960.o: $(PROCESSED_SCRIPTS) ld-lnk960.c
ldexp.o: ldexp.c ldgram.tab.h
ldmisc.o: ldmisc.c
ldsym.o: ldsym.c
+
+
clean:
- rm -f TAGS $(OBJS) $(GENERATED_SOURCES) $(GENERATED_HEADERS)
- rm -f ld ld1 ld2 ld3 ld.new