Commit | Line | Data |
---|---|---|
eb02fd64 RP |
1 | # |
2 | # Makefile for ld version 2 | |
3 | # | |
4 | # $Id$ | |
5 | # | |
6 | ||
7 | srcdir = . | |
8 | ||
9 | BASEDIR = $(srcdir)/.. | |
10 | BFDDIR = $(BASEDIR)/bfd | |
11 | INCLUDE = $(BASEDIR)/include-cygnus | |
12 | INCLUDES = -I. -I$(srcdir) -I$(INCLUDE) -I$(BFDDIR) | |
13 | DEBUG = -g | |
14 | CFLAGS = $(INCLUDES) $(DEBUG) | |
15 | ||
16 | # go directly to ld.new in case this ld isn't capable of | |
17 | # linking native object on this host. It can be renamed on | |
18 | # install. | |
19 | PROGS = ld.new | |
20 | ||
21 | # for self hosting | |
22 | GNUTARGET=a.out-generic-big | |
23 | LDEMULATION=gld | |
24 | bfdlib=$(BASEDIR)/bfd/Host-$(host)/libbfd.a | |
25 | ||
26 | OBJS= ldgram.o ldlex.o ldlang.o ldmain.o ldwrite.o ldexp.o ld-lnk960.o \ | |
27 | ld-gld.o ld-gld960.o ld-emul.o ldversion.o ldmisc.o ldsym.o ldfile.o | |
28 | ||
29 | HEADERS=config.h ldmain.h ldmain.h ldmisc.h ldsym.h ldlang.h ldexp.h \ | |
30 | ldlex.h ldwrite.h ldversion.h ld-emul.h ldfile.h ldgram.h ld.h | |
31 | ||
32 | MANSOURCES=ld.tex | |
33 | ||
34 | LDCSOURCES=ldlang.c ldmain.c ldwrite.c ld-lnk960.c ld-gld.c \ | |
35 | ld-gld960.c ld-emul.c ldversion.c ldmisc.c ldexp.c ldsym.c ldfile.c | |
36 | ||
37 | GENERATED_SOURCES=ldgram.tab.c ldlex.c ldgram.tab.h y.tab.h | |
38 | GENERATED_HEADERS=ldgram.tab.h | |
39 | ||
40 | LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l | |
41 | ||
42 | #BFDSOURCES=../bfd/libbfd.c ../bfd/bfd.c ../bfd/sunos.c ../bfd/icoff.c ../bfd/b.out.c ../bfd/archive.c ../bfd/srec.c | |
43 | ||
44 | SOURCES= $(LDSOURCES) $(BFDSOURCES) | |
45 | LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES) | |
46 | ||
47 | all: $(PROGS) | |
48 | ||
49 | $(PROGS): $(OBJS) | |
50 | # (cd ../bfd; make) | |
51 | # LDEMULATION=gld; export LDEMULATION; GNUTARGET=a.out-generic-big;./ldok -format a.out-generic-big -o ld /lib/crt0.o $(OBJS) $(bfdlib) -lc /usr/local/lib/gcc/sparc/1.91/gnulib | |
52 | # gld -o ld /lib/crt0.o $(OBJS) $(bfdlib) -lc /usr/local/lib/gcc/sparc/1.91/gnulib | |
53 | $(CC) -Bstatic -o ld.new $(OBJS) $(bfdlib) | |
54 | ||
55 | ||
56 | ld1: ld | |
57 | gcc -v -B./ -o ld1 $(OBJS) $(bfdlib) | |
58 | ||
59 | ld2: ld1 | |
60 | mv ld1 ld | |
61 | gcc -v -B./ -o ld2 $(OBJS) $(bfdlib) | |
62 | ||
63 | ld3: ld2 | |
64 | mv ld2 ld | |
65 | gcc -v -B./ -o ld3 $(OBJS) $(bfdlib) | |
66 | ||
67 | ld.dvi:ld.tex | |
68 | tex ld.tex | |
69 | ||
70 | ldgram.o:ldgram.y | |
71 | yacc -d $(srcdir)/ldgram.y | |
72 | mv y.tab.c ldgram.tab.c | |
73 | $(CC) -c $(CFLAGS) ldgram.tab.c | |
74 | mv ldgram.tab.o ldgram.o | |
75 | ||
76 | ldgram.tab.h:ldgram.o | |
77 | cp y.tab.h ldgram.tab.h | |
78 | ||
79 | ldlex.c: ldlex.l ldgram.tab.h | |
80 | ldlex.o: ldlex.c ldgram.tab.h | |
81 | ||
82 | ldmain.o: ldmain.c | |
83 | ldversion.o: ldversion.c | |
84 | ldfile.o: ldfile.c | |
85 | ldwrite.o: ldwrite.c | |
86 | ldlang.o: ldlang.c ldgram.tab.h | |
87 | ld-gld.o: ld-gld.c | |
88 | ld-gld960.o: ld-gld960.c | |
89 | ld-emul.o:ld-emul.c | |
90 | ld-lnk960.o:ld-lnk960.c | |
91 | ldexp.o:ldexp.c ldgram.tab.h | |
92 | ldmisc.o:ldmisc.c | |
93 | ldsym.o:ldsym.c | |
94 | ||
95 | clean: | |
96 | - rm -f $(OBJS) $(GENERATED_SOURCES) $(GENERATED_HEADERS) | |
97 | - rm -f ld ld1 ld2 | |
98 | ||
99 | ||
100 | lintlog:$(SOURCES) Makefile | |
101 | $(LINT) -abhxzn $(CFLAGS) $(LINTSOURCES) \ | |
102 | | grep -v "pointer casts may be troublesome" \ | |
103 | | grep -v "possible pointer alignment problem" \ | |
104 | | grep -v "ignore" \ | |
105 | | grep -v "conversion from long may lose accuracy" \ | |
106 | | grep -v "warning: constant argument to NOT" \ | |
107 | | grep -v "enumeration type clash, operator CAST" \ | |
108 | | grep -v "warning: constant in conditional context"\ | |
109 | | grep -v "archive\.c" | |
110 | ||
111 | ||
112 | tags TAGS:$(SOURCES) $(HEADERS) | |
113 | etags -t $(SOURCES) $(HEADERS) | |
114 | ||
115 | release: | |
116 | (cd /4/steve/ld; tar cf - $(LDSOURCES) $(HEADERS) $(MANSOURCES)) | tar xf - | |
117 | ||
118 | objdump:objdump.c | |
119 | ||
120 | install: $(PROGS) | |
121 | rm -f $G960BASE/bin/$(PROGS) | |
122 | cp $(PROGS) $$G960BASE/bin/gld960c | |
123 | ||
124 | #----------------------------------------------------------------------------- | |
125 | # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT | |
126 | # | |
127 | # 'VERSION' file must be present and contain a string of the form "x.y" | |
128 | #----------------------------------------------------------------------------- | |
129 | ||
130 | ver960.c: FORCE | |
131 | rm -f ver960.c | |
132 | echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c | |
133 | ||
134 | ||
135 | # This target should be invoked before building a new release. | |
136 | # 'VERSION' file must be present and contain a string of the form "x.y" | |
137 | # | |
138 | roll: | |
139 | @V=`cat VERSION` ; \ | |
140 | MAJ=`sed 's/\..*//' VERSION` ; \ | |
141 | MIN=`sed 's/.*\.//' VERSION` ; \ | |
142 | V=$$MAJ.`expr $$MIN + 1` ; \ | |
143 | rm -f VERSION ; \ | |
144 | echo $$V >VERSION ; \ | |
145 | echo Version $$V | |
146 | ||
147 | # Dummy target to force execution of dependent targets. | |
148 | # | |
149 | .force: | |
150 | FORCE: | |
151 | ||
152 | # Target to uncomment host-specific lines in this makefile. Such lines must | |
153 | # have the following string beginning in column 1: #__<hostname>__# | |
154 | # Original Makefile is backed up as 'Makefile.old'. | |
155 | # | |
156 | # Invoke with: make make HOST=xxx | |
157 | # | |
158 | make: | |
159 | -@if test $(HOST)x = x ; then \ | |
160 | echo '\aSpecify "make make HOST=???"'; \ | |
161 | exit 1; \ | |
162 | fi ; \ | |
163 | grep -s "^#The next line was generated by 'make make'" Makefile; \ | |
164 | if test $$? = 0 ; then \ | |
165 | echo "\aMakefile has already been processed with 'make make'";\ | |
166 | exit 1; \ | |
167 | fi ; \ | |
168 | mv -f Makefile Makefile.old; \ | |
169 | echo "#The next line was generated by 'make make'" >Makefile ; \ | |
170 | echo "HOST=$(HOST)" >>Makefile ; \ | |
171 | echo >>Makefile ; \ | |
172 | sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile | |
173 | ||
174 | #\f | |
175 | ||
176 | Makefile: $(srcdir)/Makefile.in $(srcdir)/configure | |
177 | (cd $(srcdir) ; configure -host=$(host) $(target)) | |
178 | ||
179 | ### Local Variables: *** | |
180 | ### mode:fundamental *** | |
181 | ### page-delimiter: "^#\f" *** | |
182 | ### End: *** | |
183 | ### end of file |