dc1d11291830949f25b6ace11415e6e06785d71f
[external/binutils.git] / gas / Makefile.in
1 # Makefile for GNU Assembler
2 #   Copyright (C) 1987-1992, 1993 Free Software Foundation, Inc.
3
4 # This file is part of GNU GAS.
5
6 # GNU GAS is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
10
11 # GNU GAS is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with GNU GAS; see the file COPYING.  If not, write to
18 # the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20 # The targets for external use include:
21 # all, doc, proto, install, uninstall, includes, TAGS,
22 # clean, mostlyclean, distclean, realclean, stage1, stage2, stage3, stage4.
23
24 # Variables that exist for you to override.
25 # See below for how to change them for certain systems.
26
27 VPATH = @srcdir@
28 srcdir = @srcdir@
29 srcroot = $(srcdir)/..
30
31 target_alias = @target_alias@
32 prefix = @prefix@
33
34 program_transform_name = @program_transform_name@
35 exec_prefix = @exec_prefix@
36 bindir = $(exec_prefix)/bin
37 libdir = $(exec_prefix)/lib
38 tooldir = $(exec_prefix)/$(target_alias)
39
40 datadir = $(prefix)/lib
41 mandir = $(prefix)/man
42 man1dir = $(mandir)/man1
43 man2dir = $(mandir)/man2
44 man3dir = $(mandir)/man3
45 man4dir = $(mandir)/man4
46 man5dir = $(mandir)/man5
47 man6dir = $(mandir)/man6
48 man7dir = $(mandir)/man7
49 man8dir = $(mandir)/man8
50 man9dir = $(mandir)/man9
51 infodir = $(prefix)/info
52 includedir = $(prefix)/include
53 docdir = $(datadir)/doc
54
55 VERSION=cygnus-2.5.3
56
57 SHELL = /bin/sh
58
59 INSTALL = $${srcroot}/install.sh -c
60 INSTALL_PROGRAM = $(INSTALL)
61 INSTALL_DATA = $(INSTALL)
62 INSTALL_XFORM = $(INSTALL) -t='-e $(program_transform_name)'
63 INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1
64
65 DISTSTUFF= make-gas.com m68k-parse.c
66
67 AR = ar
68 AR_FLAGS = qv
69 BISON = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
70 BISONFLAGS =
71 MAKEINFO = makeinfo
72 TEXI2DVI = texi2dvi
73 RANLIB = ranlib
74 CC = @CC@
75 CFLAGS = -g
76
77 MAKEOVERRIDES=
78
79 FLAGS_TO_PASS = \
80         "prefix=$(prefix)" \
81         "exec_prefix=$(exec_prefix)" \
82         "tooldir=$(tooldir)" \
83         "AR=$(AR)" \
84         "AR_FLAGS=$(AR_FLAGS)" \
85         "CC=$(CC)" \
86         "CFLAGS=$(CFLAGS)" \
87         "RANLIB=$(RANLIB)" \
88         "LOADLIBES=$(LOADLIBES)" \
89         "LDFLAGS=$(LDFLAGS)" \
90         "BISON=$(BISON)" \
91         "LEX=$(LEX)" \
92         "MAKEINFO=$(MAKEINFO)" \
93         "INSTALL=$(INSTALL)" \
94         "INSTALL_DATA=$(INSTALL_DATA)" \
95         "INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
96
97 RUNTEST = `if [ -f ${srcdir}/../dejagnu/runtest ] ; then \
98                 echo ${srcdir}/../dejagnu/runtest ; else echo runtest; \
99            fi`
100 RUNTESTFLAGS=
101 CHECKFLAGS= \
102         "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
103         "RUNTEST=$(RUNTEST)"
104
105 # Lists of files for various purposes.
106
107 REAL_SOURCES = \
108         $(srcdir)/app.c \
109         $(srcdir)/as.c \
110         $(srcdir)/atof-generic.c \
111         $(srcdir)/bignum-copy.c \
112         $(srcdir)/cond.c \
113         $(srcdir)/expr.c \
114         $(srcdir)/flonum-konst.c \
115         $(srcdir)/flonum-copy.c \
116         $(srcdir)/flonum-mult.c \
117         $(srcdir)/frags.c \
118         $(srcdir)/hash.c \
119         $(srcdir)/input-file.c \
120         $(srcdir)/input-scrub.c \
121         $(srcdir)/literal.c \
122         $(srcdir)/messages.c \
123         $(srcdir)/output-file.c \
124         $(srcdir)/read.c \
125         $(srcdir)/subsegs.c \
126         $(srcdir)/symbols.c \
127         $(srcdir)/write.c \
128         $(srcdir)/listing.c \
129         $(srcdir)/ecoff.c \
130         $(srcdir)/stabs.c
131
132 # in an expedient order
133 LINKED_SOURCES = \
134         targ-cpu.c \
135         obj-format.c \
136         atof-targ.c
137
138 SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES)
139
140 REAL_HEADERS = \
141         $(srcdir)/as.h \
142         $(srcdir)/bignum.h \
143         $(srcdir)/expr.h \
144         $(srcdir)/flonum.h \
145         $(srcdir)/frags.h \
146         $(srcdir)/hash.h \
147         $(srcdir)/input-file.h \
148         $(srcdir)/listing.h \
149         $(srcdir)/tc.h \
150         $(srcdir)/obj.h \
151         $(srcdir)/read.h \
152         $(srcdir)/struc-symbol.h \
153         $(srcdir)/subsegs.h \
154         $(srcdir)/symbols.h \
155         $(srcdir)/write.h \
156         $(srcdir)/ecoff.h
157
158 LINKED_HEADERS = \
159         targ-env.h \
160         targ-cpu.h \
161         obj-format.h \
162         atof-targ.h
163
164 HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS)
165
166 # @target_frag@
167
168 OBJS = \
169         targ-cpu.o \
170         obj-format.o \
171         atof-targ.o \
172         app.o \
173         as.o \
174         atof-generic.o \
175         bignum-copy.o \
176         cond.o \
177         expr.o \
178         flonum-konst.o \
179         flonum-copy.o \
180         flonum-mult.o \
181         frags.o \
182         hash.o \
183         input-file.o \
184         input-scrub.o \
185         literal.o \
186         messages.o \
187         output-file.o \
188         read.o \
189         subsegs.o \
190         symbols.o \
191         write.o \
192         listing.o \
193         ecoff.o \
194         stabs.o \
195         @extra_objects@ \
196         $(TE_OBJS)
197
198 all: .gdbinit as.new gasp.new
199         @srcroot=`cd $(srcroot); pwd`; export srcroot; \
200         (cd doc ; $(MAKE) $(FLAGS_TO_PASS) all)
201
202 dvi info install-info clean-info:
203         @srcroot=`cd $(srcroot); pwd`; export srcroot; \
204         (cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@)
205
206 make-gas.com: stamp-mk.com
207 stamp-mk.com: vmsconf.sh Makefile
208         sh $(srcdir)/vmsconf.sh $(OBJS) > new-make.com
209         $(srcdir)/../move-if-change new-make.com $(srcdir)/make-gas.com
210         touch stamp-mk.com
211
212 # Now figure out from those variables how to compile and link.
213
214 # This is the variable actually used when we compile.
215 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CROSS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
216
217 # How to link with both our special library facilities
218 # and the system's installed libraries.
219
220 LIBS = @OPCODES_LIB@ @BFDLIB@ $(LOCAL_LOADLIBES) ../libiberty/libiberty.a
221
222 # Specify the directories to be searched for header files.
223 # Both . and srcdir are used, in that order,
224 # so that tm.h and config.h will be found in the compilation
225 # subdirectory rather than in the source directory.
226 INCLUDES = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(srcdir)/../include -I$(srcdir)/.. -I$(srcdir)/../bfd
227
228 # Always use -I$(srcdir)/config when compiling.
229 .c.o:
230         $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
231
232 # This tells GNU make version 3 not to export all the variables
233 # defined in this file into the environment.
234 .NOEXPORT:
235
236 # Files to be copied away after each stage in building.
237 STAGESTUFF = *.o as.new gasp.new
238
239 $(OBJS): @ALL_OBJ_DEPS@
240
241 as.new: $(OBJS) $(LIBS)
242         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES)
243
244 $(OBJS): config.h as.h targ-env.h obj-format.h targ-cpu.h flonum.h expr.h \
245         struc-symbol.h write.h frags.h hash.h read.h symbols.h tc.h obj.h \
246         listing.h bignum.h
247
248 gasp.new: gasp.o
249         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gasp.new gasp.o $(LIBS) $(LOADLIBES)
250
251 installcheck:
252         @echo No installcheck target is available yet for the GNU assembler.
253
254 check:
255         @(here=`pwd` ; export here ; \
256           cd testsuite ; $(MAKE) $(FLAGS_TO_PASS) $(CHECKFLAGS) check)
257
258 config.status: configure
259         if [ -r config.status ]; then \
260           sh ./config.status --recheck ; \
261         else \
262           echo You must configure gas.  Look at the INSTALL file for details. ; \
263           exit 1 ; \
264         fi
265
266 config.h: config-stamp ; @true
267 config-stamp: Makefile conf
268         -rm -f config.new config-stamp
269         echo '/* config.h.  Generated automatically by make.  */' > config.new
270         echo '#ifndef GAS_VERSION'                      >> config.new
271         echo '#define GAS_VERSION "$(VERSION)"'         >> config.new
272         echo ''                                         >> config.new
273         cat conf                                        >> config.new
274         echo '#endif /* GAS_VERSION */'                 >> config.new
275         $(srcdir)/../move-if-change config.new config.h
276         touch config-stamp
277
278 # Compiling object files from source files.
279
280 TARG_CPU_DEP_a29k    =
281 TARG_CPU_DEP_alpha   =
282 # start-sanitize-arc
283 TARG_CPU_DEP_arc     = $(srcdir)/../include/opcode/arc.h
284 # end-sanitize-arc
285 TARG_CPU_DEP_arm     =
286 TARG_CPU_DEP_generic =
287 TARG_CPU_DEP_h8300   = $(srcdir)/../include/opcode/h8300.h
288 TARG_CPU_DEP_h8500   = $(srcdir)/../opcodes/h8500-opc.h
289 TARG_CPU_DEP_hppa    =
290 TARG_CPU_DEP_i386    = $(srcdir)/../include/opcode/i386.h
291 TARG_CPU_DEP_i860    =
292 TARG_CPU_DEP_i960    =
293 TARG_CPU_DEP_m68k    = $(srcdir)/../include/opcode/m68k.h \
294                         $(srcdir)/config/m68k-parse.h
295 TARG_CPU_DEP_m88k    = $(srcdir)/config/m88k-opcode.h
296 TARG_CPU_DEP_mips    = $(srcdir)/../include/opcode/mips.h
297 TARG_CPU_DEP_ns32k   =
298 TARG_CPU_DEP_ppc     =
299 # start-sanitize-rce
300 TARG_CPU_DEP_rce     = $(srcdir)/../opcodes/rce-opc.h
301 # end-sanitize-rce
302 TARG_CPU_DEP_sh      = $(srcdir)/../opcodes/sh-opc.h
303 TARG_CPU_DEP_sparc   =
304 TARG_CPU_DEP_tahoe   =
305 TARG_CPU_DEP_vax     =
306 TARG_CPU_DEP_w65     = $(srcdir)/../opcodes/w65-opc.h
307 TARG_CPU_DEP_z8k     = $(srcdir)/../opcodes/z8k-opc.h
308
309 gasp.o : gasp.c config.h
310 app.o : app.c write.h
311 as.o : as.c output-file.h write.h subsegs.h
312 atof-generic.o : atof-generic.c
313 bignum-copy.o : bignum-copy.c
314 cond.o : cond.c
315 debug.o : debug.c subsegs.h
316 expr.o : expr.c
317 flonum-konst.o : flonum-konst.c
318 flonum-copy.o : flonum-copy.c
319 flonum-mult.o : flonum-mult.c
320 frags.o : frags.c subsegs.h
321 hash.o : hash.c
322 input-file.o : input-file.c input-file.h
323 input-scrub.o : input-scrub.c input-file.h
324 listing.o : listing.c input-file.h subsegs.h
325 literal.o : literal.c subsegs.h
326 messages.o : messages.c
327 output-file.o : output-file.c output-file.h
328 read.o : read.c
329 subsegs.o : subsegs.c subsegs.h
330 symbols.o : symbols.c subsegs.h
331 write.o : write.c subsegs.h output-file.h
332 ecoff.o : ecoff.c ecoff.h \
333         $(srcdir)/../include/coff/internal.h $(srcdir)/../include/coff/sym.h \
334         $(srcdir)/../include/coff/ecoff.h \
335         $(srcdir)/../include/coff/symconst.h \
336         $(srcdir)/../include/aout/stab_gnu.h
337 stabs.o : stabs.c subsegs.h $(srcdir)/../include/aout/stab_gnu.h
338 atof-targ.o : atof-targ.c
339 obj-format.o : obj-format.c
340 targ-cpu.o : targ-cpu.c $(TARG_CPU_DEP_@target_cpu_type@)
341
342 obj-elf.o : $(srcdir)/config/obj-elf.c
343         $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-elf.c
344 obj-ecoff.o : $(srcdir)/config/obj-ecoff.c
345         $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-ecoff.c
346
347 e-mipself.o : $(srcdir)/config/e-mipself.c
348         $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-mipself.c
349 e-mipsecoff.o : $(srcdir)/config/e-mipsecoff.c
350         $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-mipsecoff.c
351
352 # The m68k operand parser.
353
354 m68k-parse.c: $(srcdir)/config/m68k-parse.y
355         $(BISON) $(BISONFLAGS) $(srcdir)/config/m68k-parse.y
356         mv -f y.tab.c m68k-parse.c
357 m68k-parse.o: m68k-parse.c $(srcdir)/config/m68k-parse.h
358
359 # Remake the info files.
360
361 doc: $(srcdir)/as.info
362
363 $(srcdir)/as.info: $(srcdir)/doc/as.texinfo
364         @(cd doc; $(MAKE) $(FLAGS_TO_PASS) as.info; mv as.info $srcdir) 
365
366 diststuff: $(DISTSTUFF)
367
368 clean-here:
369         -rm -f $(STAGESTUFF) core stamp-mk.com
370
371 clean mostlyclean: clean-here
372         @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@
373         @if [ -d testsuite ] ; then \
374           cd testsuite ; $(MAKE) $(FLAGS_TO_PASS) $@ ; \
375         else true; fi
376
377 # Like clean but also delete the links made to configure gas.
378 distclean: clean-here
379         @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@
380         @if [ -d testsuite ] ; then \
381           cd testsuite ; $(MAKE) $(FLAGS_TO_PASS) $@ ; \
382         else true; fi
383         -rm -f config.status Makefile targ-env.h targ-cpu.h \
384                 targ-cpu.c obj-format.h obj-format.c atof-targ.c TAGS \
385                 config-stamp config.h conf config.log config.cache .gdbinit
386 realclean: clean distclean
387         -rm -rf $(DISTSTUFF)
388
389 # Entry points `install', `includes' and `uninstall'.
390
391 # Copy the files into directories where they will be run.
392 install:
393         srcroot=`cd $(srcroot); pwd`; export srcroot; \
394         $(INSTALL_XFORM) as.new $(bindir)/as; \
395         $(INSTALL_XFORM1) $(srcdir)/doc/as.1 $(man1dir)/as.1; \
396         n=`echo as | sed '$(program_transform_name)'`; \
397         if [ -d $(tooldir) ]; then \
398           if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \
399           rm -f $(tooldir)/bin/as; \
400           ln $(bindir)/$$n $(tooldir)/bin/as >/dev/null 2>/dev/null \
401            || $(INSTALL_PROGRAM) as.new $(tooldir)/bin/as; \
402         else true; fi
403         srcroot=`cd $(srcroot); pwd`; export srcroot; \
404         $(INSTALL_XFORM) gasp.new $(bindir)/gasp; \
405         n=`echo gasp | sed '$(program_transform_name)' `; \
406         if [ -d $(tooldir) ]; then \
407           if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \
408           rm -f $(tooldir)/bin/gasp; \
409           ln $(bindir)/$$n $(tooldir)/bin/gasp >/dev/null 2>/dev/null \
410            || $(INSTALL_PROGRAM) gasp.new $(tooldir)/bin/gasp; \
411         else true; fi
412
413 # Cancel installation by deleting the installed files.
414 uninstall:
415         -n=`t='$(program_transform_name)'; echo as | sed $$t`; \
416         rm -f $(bindir)/$$n; \
417         rm -f $(mandir)/$$n.1
418         -n=`t='$(program_transform_name)'; echo gasp | sed $$t`; \
419         rm -f $(bindir)/$$n; \
420
421 # These exist for maintenance purposes.
422
423 tags TAGS: force
424         etags $(REAL_HEADERS) $(REAL_SOURCES) $(srcdir)/config/*.[hc] $(srcdir)/README $(srcdir)/Makefile.in
425
426 bootstrap: as.new force
427         $(MAKE) stage1
428         rm -f stage && ln -s stage1 stage
429         $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
430         $(MAKE) stage2
431         rm -f stage && ln -s stage2 stage
432         $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
433         $(MAKE) comparison against=stage2
434
435 bootstrap2: force
436         rm -f stage && ln -s stage1 stage
437         $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
438         $(MAKE) stage2
439         rm -f stage && ln -s stage2 stage
440         $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
441         $(MAKE) comparison against=stage2
442
443 bootstrap3: force
444         rm -f stage && ln -s stage2 stage
445         $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
446         $(MAKE) comparison against=stage2
447
448 # Copy the object files from a particular stage into a subdirectory.
449 stage1: force
450         -mkdir stage1
451         -mv $(STAGESTUFF) stage1
452         if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi
453
454 stage2: force
455         -mkdir stage2
456         -mv $(STAGESTUFF) stage2
457         if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi
458
459 stage3: force
460         -mkdir stage3
461         -mv $(STAGESTUFF) stage3
462         if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi
463
464 against=stage2
465
466 # This rule is derived from corresponding code in the Makefile.in for gcc.
467 # The "tail +16c" is to bypass headers which may include timestamps or
468 # temporary assembly file names.
469 comparison: force
470         x=0 ; \
471         for file in $(STAGESTUFF) ; do \
472           tail +16c ./$$file > tmp-foo1; \
473           if tail +16c ${against}/$$file > tmp-foo2 2>/dev/null ; then \
474             if cmp tmp-foo1 tmp-foo2 ; then \
475               true ; \
476             else \
477               echo $$file differs ; \
478               x=1 ; \
479             fi ; \
480           else true; fi ; \
481         done ; \
482         exit $$x
483         -rm -f tmp-foo*
484
485 de-stage1: force
486         - (cd stage1 ; rm -f as ; mv -f * ..)
487         - rmdir stage1
488
489 de-stage2: force
490         - (cd stage2 ; rm -f as ; mv -f * ..)
491         - rmdir stage2
492
493 de-stage3: force
494         - (cd stage3 ; rm -f as ; mv -f * ..)
495         - rmdir stage3
496
497 #In GNU Make, ignore whether `stage*' exists.
498 .PHONY: stage1 stage2 stage3 stage4 clean mostlyclean realclean distclean
499 .PHONY: TAGS bootstrap
500
501 force:
502
503 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) \
504                 $(srcdir)/configure.in config.status conf.in
505         $(SHELL) ./config.status
506 .gdbinit: $(srcdir)/gdbinit.in config.status
507         $(SHELL) ./config.status