Commit | Line | Data |
---|---|---|
eb02fd64 RP |
1 | # |
2 | # Makefile for ld version 2 | |
3 | # | |
4 | # $Id$ | |
5 | # | |
6 | ||
7 | srcdir = . | |
8 | ||
8c32cf6e RP |
9 | destdir = /usr/local |
10 | ||
11 | version=`$(srcdir)/../gcc$(subdir)/gcc -dumpversion` | |
12 | prefix = $(destdir) | |
13 | bindir = $(prefix)/bin | |
14 | libdir = $(prefix)/lib | |
15 | libsubdir = $(libdir)/gcc/$(target)/$(version) | |
16 | ||
17 | INSTALL = install -c | |
18 | INSTALL_PROGRAM = $(INSTALL) | |
19 | INSTALL_FILE = $(INSTALL) | |
20 | ||
2ee11735 RP |
21 | BASEDIR = ../.. |
22 | HOSTDIR = ../$(HOST)/ | |
23 | INCLUDE = $(srcdir)/../include-cygnus | |
24 | INCLUDES = -I. -I$(srcdir) -I$(INCLUDE) | |
eb02fd64 | 25 | DEBUG = -g |
2ee11735 RP |
26 | |
27 | ||
28 | #__sun3__#EXTRA_DEF=-DHOST_SYS=SUN3_SYS | |
29 | #__sun4__#EXTRA_DEF=-DHOST_SYS=SUN4_SYS | |
30 | #__dgux__#EXTRA_DEF=-DHOST_SYS=DGUX_SYS | |
31 | ||
32 | #### target and host dependent Makefile fragments come in here. | |
33 | ### | |
34 | ||
35 | CFLAGS = $(INCLUDES) $(EXTRA_DEF) $(DEBUG) $(CDEFINES) | |
36 | LINTFLAGS = $(INCLUDES) $(EXTRA_DEF) | |
37 | ||
f78e2569 | 38 | .SUFFIXES: .y .x .script $(SUFFIXES) |
2ee11735 RP |
39 | |
40 | .y.o: | |
f78e2569 | 41 | $(YACC) $< |
2ee11735 RP |
42 | mv y.tab.c ldgram.tab.c |
43 | $(CC) -c $(CFLAGS) ldgram.tab.c | |
44 | mv ldgram.tab.o ldgram.o | |
45 | ||
eb02fd64 | 46 | |
f78e2569 SC |
47 | |
48 | ||
eb02fd64 RP |
49 | # go directly to ld.new in case this ld isn't capable of |
50 | # linking native object on this host. It can be renamed on | |
51 | # install. | |
f78e2569 SC |
52 | PROGS = $(HOSTDIR)/ld.new |
53 | MKSCRIPT = $(HOSTDIR)/mkscript | |
54 | ||
55 | .script.x: | |
56 | mkscript < $< >$*.x | |
eb02fd64 RP |
57 | |
58 | # for self hosting | |
59 | GNUTARGET=a.out-generic-big | |
60 | LDEMULATION=gld | |
f2e91404 | 61 | BFDLIB=$(srcdir)/../bfd$(subdir)/libbfd.a |
eb02fd64 | 62 | |
2ee11735 | 63 | OBJS= ldgram.o ldlex.o ldlang.o ldmain.o ldwrite.o ldexp.o ld-lnk960.o ld-gld68k.o \ |
f78e2569 | 64 | ld-gld.o ld-gld960.o ld-emul.o ldversion.o ldmisc.o ldsym.o ld-vanilla.o ldfile.o |
eb02fd64 RP |
65 | |
66 | HEADERS=config.h ldmain.h ldmain.h ldmisc.h ldsym.h ldlang.h ldexp.h \ | |
67 | ldlex.h ldwrite.h ldversion.h ld-emul.h ldfile.h ldgram.h ld.h | |
68 | ||
69 | MANSOURCES=ld.tex | |
70 | ||
2ee11735 | 71 | LDCSOURCES=ldlang.c ldmain.c ldwrite.c ld-lnk960.c ld-gld.c ld-gld68k.c \ |
f78e2569 | 72 | ld-gld960.c ld-emul.c ldversion.c ldmisc.c ldexp.c ldsym.c ldfile.c ld-vanilla.c |
eb02fd64 RP |
73 | |
74 | GENERATED_SOURCES=ldgram.tab.c ldlex.c ldgram.tab.h y.tab.h | |
75 | GENERATED_HEADERS=ldgram.tab.h | |
76 | ||
77 | LDSOURCES=$(LDCSOURCES) ldgram.y ldlex.l | |
78 | ||
2ee11735 | 79 | BFDSOURCES=../../bfd/common/*.c |
eb02fd64 RP |
80 | |
81 | SOURCES= $(LDSOURCES) $(BFDSOURCES) | |
82 | LINTSOURCES= $(LDCSOURCES) $(BFDSOURCES) $(GENERATED_SOURCES) | |
83 | ||
f78e2569 SC |
84 | all: Makefile mkscript $(PROGS) |
85 | ||
86 | ||
2ee11735 RP |
87 | |
88 | ||
89 | ||
90 | #$(BFDLIB): $(BFDSOURCES) | |
91 | # (cd ../bfd; make) | |
eb02fd64 | 92 | |
2ee11735 | 93 | $(PROGS): $(OBJS) $(BFDLIB) |
eb02fd64 | 94 | # (cd ../bfd; make) |
2ee11735 RP |
95 | # 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 |
96 | # gld -o ld /lib/crt0.o $(OBJS) $(BFDLIB) -lc /usr/local/lib/gcc/sparc/1.91/gnulib | |
97 | $(CC) -Bstatic -o ld.new $(OBJS) $(BFDLIB) | |
eb02fd64 RP |
98 | |
99 | ||
f78e2569 SC |
100 | ld1: ld.new |
101 | $(HOSTING_EMU); ./ld.new -o ld1 $(HOSTING_CRT0) $(OBJS) $(BFDLIB) $(HOSTING_LIBS) | |
eb02fd64 RP |
102 | |
103 | ld2: ld1 | |
f78e2569 | 104 | $(HOSTING_EMU); ./ld1 -o ld2 $(HOSTING_CRT0) $(OBJS) $(BFDLIB) $(HOSTING_LIBS) |
eb02fd64 RP |
105 | |
106 | ld3: ld2 | |
f78e2569 | 107 | $(HOSTING_EMU); ./ld2 -o ld3 $(HOSTING_CRT0) $(OBJS) $(BFDLIB) $(HOSTING_LIBS) |
eb02fd64 RP |
108 | |
109 | ld.dvi:ld.tex | |
110 | tex ld.tex | |
111 | ||
f78e2569 SC |
112 | |
113 | 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 | |
114 | 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 | |
115 | ||
116 | ||
117 | $(MKSCRIPT):mkscript.c $(SCRIPTS) | |
118 | ||
119 | ||
120 | ||
2ee11735 RP |
121 | ldgram.o: ldgram.y |
122 | ldgram.tab.h:ldgram.y | |
eb02fd64 | 123 | cp y.tab.h ldgram.tab.h |
f78e2569 SC |
124 | |
125 | ld-gld.o: $(PROCESSED_SCRIPTS) ld-gld.c | |
126 | ||
eb02fd64 RP |
127 | |
128 | ldlex.c: ldlex.l ldgram.tab.h | |
129 | ldlex.o: ldlex.c ldgram.tab.h | |
130 | ||
131 | ldmain.o: ldmain.c | |
132 | ldversion.o: ldversion.c | |
133 | ldfile.o: ldfile.c | |
134 | ldwrite.o: ldwrite.c | |
135 | ldlang.o: ldlang.c ldgram.tab.h | |
f78e2569 SC |
136 | |
137 | ld-gld68k.o: $(PROCESSED_SCRIPTS) ld-gld68k.c | |
138 | ld-gld960.o: $(PROCESSED_SCRIPTS) ld-gld960.c | |
2ee11735 | 139 | ld-emul.o: ld-emul.c |
f78e2569 SC |
140 | ld-vanilla.o: ld-vanilla.c |
141 | ld-lnk960.o: $(PROCESSED_SCRIPTS) ld-lnk960.c | |
2ee11735 RP |
142 | ldexp.o: ldexp.c ldgram.tab.h |
143 | ldmisc.o: ldmisc.c | |
144 | ldsym.o: ldsym.c | |
eb02fd64 | 145 | |
f78e2569 SC |
146 | |
147 | ||
eb02fd64 | 148 | clean: |
f2e91404 | 149 | - rm -f TAGS $(OBJS) $(GENERATED_SOURCES) $(GENERATED_HEADERS) |
2ee11735 | 150 | - rm -f ld ld1 ld2 ld3 ld.new |
eb02fd64 RP |
151 | |
152 | ||
153 | lintlog:$(SOURCES) Makefile | |
2ee11735 | 154 | $(LINT) -abhxzn $(LINTFLAGS) $(LINTSOURCES) \ |
eb02fd64 RP |
155 | | grep -v "pointer casts may be troublesome" \ |
156 | | grep -v "possible pointer alignment problem" \ | |
157 | | grep -v "ignore" \ | |
158 | | grep -v "conversion from long may lose accuracy" \ | |
159 | | grep -v "warning: constant argument to NOT" \ | |
160 | | grep -v "enumeration type clash, operator CAST" \ | |
161 | | grep -v "warning: constant in conditional context"\ | |
162 | | grep -v "archive\.c" | |
163 | ||
164 | ||
165 | tags TAGS:$(SOURCES) $(HEADERS) | |
166 | etags -t $(SOURCES) $(HEADERS) | |
167 | ||
168 | release: | |
169 | (cd /4/steve/ld; tar cf - $(LDSOURCES) $(HEADERS) $(MANSOURCES)) | tar xf - | |
170 | ||
171 | objdump:objdump.c | |
172 | ||
173 | install: $(PROGS) | |
8c32cf6e | 174 | $(INSTALL_PROGRAM) ld.new $(libsubdir)/ld |
eb02fd64 RP |
175 | |
176 | #----------------------------------------------------------------------------- | |
177 | # 'STANDARD' GNU/960 TARGETS BELOW THIS POINT | |
178 | # | |
179 | # 'VERSION' file must be present and contain a string of the form "x.y" | |
180 | #----------------------------------------------------------------------------- | |
181 | ||
182 | ver960.c: FORCE | |
183 | rm -f ver960.c | |
184 | echo "char ${TARG}_ver[]= \"${TARG} `cat VERSION`, `date`\";" > ver960.c | |
185 | ||
186 | ||
187 | # This target should be invoked before building a new release. | |
188 | # 'VERSION' file must be present and contain a string of the form "x.y" | |
189 | # | |
190 | roll: | |
191 | @V=`cat VERSION` ; \ | |
192 | MAJ=`sed 's/\..*//' VERSION` ; \ | |
193 | MIN=`sed 's/.*\.//' VERSION` ; \ | |
194 | V=$$MAJ.`expr $$MIN + 1` ; \ | |
195 | rm -f VERSION ; \ | |
196 | echo $$V >VERSION ; \ | |
197 | echo Version $$V | |
198 | ||
199 | # Dummy target to force execution of dependent targets. | |
200 | # | |
201 | .force: | |
202 | FORCE: | |
203 | ||
204 | # Target to uncomment host-specific lines in this makefile. Such lines must | |
205 | # have the following string beginning in column 1: #__<hostname>__# | |
206 | # Original Makefile is backed up as 'Makefile.old'. | |
207 | # | |
208 | # Invoke with: make make HOST=xxx | |
209 | # | |
210 | make: | |
211 | -@if test $(HOST)x = x ; then \ | |
212 | echo '\aSpecify "make make HOST=???"'; \ | |
213 | exit 1; \ | |
214 | fi ; \ | |
215 | grep -s "^#The next line was generated by 'make make'" Makefile; \ | |
216 | if test $$? = 0 ; then \ | |
217 | echo "\aMakefile has already been processed with 'make make'";\ | |
218 | exit 1; \ | |
219 | fi ; \ | |
220 | mv -f Makefile Makefile.old; \ | |
221 | echo "#The next line was generated by 'make make'" >Makefile ; \ | |
222 | echo "HOST=$(HOST)" >>Makefile ; \ | |
223 | echo >>Makefile ; \ | |
224 | sed "s/^#__$(HOST)__#//" < Makefile.old >>Makefile | |
225 | ||
226 | #\f | |
227 | ||
228 | Makefile: $(srcdir)/Makefile.in $(srcdir)/configure | |
f2e91404 | 229 | (cd $(srcdir) ; \ |
8c32cf6e RP |
230 | ./configure +destdir=$(destdir) \ |
231 | +norecurse \ | |
232 | `if [ "$(srcdir)" != "." ] ; then echo +f; fi` \ | |
233 | $(host) +target=$(target)) | |
eb02fd64 RP |
234 | |
235 | ### Local Variables: *** | |
236 | ### mode:fundamental *** | |
237 | ### page-delimiter: "^#\f" *** | |
238 | ### End: *** | |
239 | ### end of file |