1 # Makefile for GNU Assembler
2 # Copyright (C) 1987-1992, 1993 Free Software Foundation, Inc.
4 # This file is part of GNU GAS.
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)
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.
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.
20 # The targets for external use include:
21 # all, doc, proto, install, uninstall, includes, TAGS,
22 # clean, mostlyclean, distclean, realclean, stage1, stage2, stage3, stage4.
24 # Variables that exist for you to override.
25 # See below for how to change them for certain systems.
29 srcroot = $(srcdir)/..
31 target_alias = @target_alias@
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)
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
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
65 DISTSTUFF= make-gas.com m68k-parse.c
69 BISON = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
79 EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
80 echo $${rootme}/../expect/expect ; \
81 else echo expect ; fi`
85 "exec_prefix=$(exec_prefix)" \
86 "tooldir=$(tooldir)" \
88 "AR_FLAGS=$(AR_FLAGS)" \
92 "LOADLIBES=$(LOADLIBES)" \
93 "LDFLAGS=$(LDFLAGS)" \
96 "MAKEINFO=$(MAKEINFO)" \
97 "INSTALL=$(INSTALL)" \
98 "INSTALL_DATA=$(INSTALL_DATA)" \
99 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
101 RUNTEST = `if [ -f ${srcdir}/../dejagnu/runtest ] ; then \
102 echo ${srcdir}/../dejagnu/runtest ; else echo runtest; \
106 # Lists of files for various purposes.
111 $(srcdir)/atof-generic.c \
112 $(srcdir)/bignum-copy.c \
115 $(srcdir)/flonum-konst.c \
116 $(srcdir)/flonum-copy.c \
117 $(srcdir)/flonum-mult.c \
120 $(srcdir)/input-file.c \
121 $(srcdir)/input-scrub.c \
122 $(srcdir)/literal.c \
123 $(srcdir)/messages.c \
124 $(srcdir)/output-file.c \
126 $(srcdir)/subsegs.c \
127 $(srcdir)/symbols.c \
129 $(srcdir)/listing.c \
133 # in an expedient order
139 SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES)
148 $(srcdir)/input-file.h \
149 $(srcdir)/listing.h \
153 $(srcdir)/struc-symbol.h \
154 $(srcdir)/subsegs.h \
155 $(srcdir)/symbols.h \
165 HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS)
209 all: .gdbinit as.new gasp.new
210 @srcroot=`cd $(srcroot); pwd`; export srcroot; \
211 (cd doc ; $(MAKE) $(FLAGS_TO_PASS) all)
213 dvi info install-info clean-info:
214 @srcroot=`cd $(srcroot); pwd`; export srcroot; \
215 (cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@)
217 make-gas.com: stamp-mk.com
218 stamp-mk.com: vmsconf.sh Makefile
219 sh $(srcdir)/vmsconf.sh $(OBJS) > new-make.com
220 $(srcdir)/../move-if-change new-make.com $(srcdir)/make-gas.com
223 # Now figure out from those variables how to compile and link.
225 # This is the variable actually used when we compile.
226 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CROSS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
228 # How to link with both our special library facilities
229 # and the system's installed libraries.
231 LIBS = @OPCODES_LIB@ @BFDLIB@ $(LOCAL_LOADLIBES) ../libiberty/libiberty.a
233 # Specify the directories to be searched for header files.
234 # Both . and srcdir are used, in that order,
235 # so that tm.h and config.h will be found in the compilation
236 # subdirectory rather than in the source directory.
237 INCLUDES = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(srcdir)/../include -I$(srcdir)/.. -I$(srcdir)/../bfd
239 # Always use -I$(srcdir)/config when compiling.
241 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
243 # This tells GNU make version 3 not to export all the variables
244 # defined in this file into the environment.
247 # Files to be copied away after each stage in building.
248 STAGESTUFF = *.o as.new gasp.new
250 $(OBJS): @ALL_OBJ_DEPS@
252 as.new: $(OBJS) $(LIBS)
253 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES)
255 $(OBJS): config.h as.h targ-env.h obj-format.h targ-cpu.h flonum.h expr.h \
256 struc-symbol.h write.h frags.h hash.h read.h symbols.h tc.h obj.h \
259 gasp.new: $(GASPOBJS) ../libiberty/libiberty.a
260 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gasp.new $(GASPOBJS) ../libiberty/libiberty.a $(LOADLIBES)
263 @echo No installcheck target is available yet for the GNU assembler.
266 @echo "Making a new config file..."
269 -@mv site.exp site.bak
270 @echo "## these variables are automatically generated by make ##" > ./tmp0
271 @echo "# Do not edit here. If you wish to override these values," >> ./tmp0
272 @echo "# do so in the last section." >> ./tmp0
273 @echo set host_os @host_os@ >> ./tmp0
274 @echo set host_alias @host_alias@ >> ./tmp0
275 @echo set host_cpu @host_cpu@ >> ./tmp0
276 @echo set host_vendor @host_vendor@ >> ./tmp0
277 @echo set target_os @target_os@ >> ./tmp0
278 @echo set target_alias @target_alias@ >> ./tmp0
279 @echo set target_cpu @target_cpu@ >> ./tmp0
280 @echo set target_vendor @target_vendor@ >> ./tmp0
281 @echo set host_triplet @host@ >> ./tmp0
282 @echo set target_triplet @target@ >> ./tmp0
283 @echo set target_canonical @target@ >> ./tmp0
284 @echo set srcdir ${srcdir}/testsuite >> ./tmp0
285 @echo set exec_prefix ${exec_prefix} >> ./tmp0
286 @echo set objdir `pwd` >> ./tmp0
287 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
288 @sed -e '1,/^## All variables above are.*##/ d' < site.bak >> ./tmp0
289 @mv -f ./tmp0 site.exp
292 if [ -d testsuite ]; then \
297 rm -f testsuite/site.exp
298 cp site.exp testsuite/site.exp
299 rootme=`pwd`; export rootme; \
300 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
302 EXPECT=${EXPECT} ; export EXPECT ; \
303 if [ -f $${rootme}/../expect/expect ] ; then \
304 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
305 export TCL_LIBRARY ; fi ; \
306 $(RUNTEST) --tool gas --srcdir $${srcdir}/testsuite $(RUNTESTFLAGS)
308 config.status: configure
309 if [ -r config.status ]; then \
310 sh ./config.status --recheck ; \
312 echo You must configure gas. Look at the INSTALL file for details. ; \
316 config.h: config-stamp ; @true
317 config-stamp: Makefile conf
318 -rm -f config.new config-stamp
319 echo '/* config.h. Generated automatically by make. */' > config.new
320 echo '#ifndef GAS_VERSION' >> config.new
321 echo '#define GAS_VERSION "$(VERSION)"' >> config.new
322 echo '' >> config.new
323 cat conf >> config.new
324 echo '#endif /* GAS_VERSION */' >> config.new
325 $(srcdir)/../move-if-change config.new config.h
328 # Compiling object files from source files.
331 TARG_CPU_DEP_alpha = $(srcdir)/config/alpha-opcode.h
333 TARG_CPU_DEP_arc = $(srcdir)/../include/opcode/arc.h
336 TARG_CPU_DEP_generic =
337 TARG_CPU_DEP_h8300 = $(srcdir)/../include/opcode/h8300.h
338 TARG_CPU_DEP_h8500 = $(srcdir)/../opcodes/h8500-opc.h
340 TARG_CPU_DEP_i386 = $(srcdir)/../include/opcode/i386.h
343 TARG_CPU_DEP_m68k = $(srcdir)/../include/opcode/m68k.h \
344 $(srcdir)/config/m68k-parse.h subsegs.h
345 TARG_CPU_DEP_m88k = $(srcdir)/config/m88k-opcode.h
346 TARG_CPU_DEP_mips = $(srcdir)/../include/opcode/mips.h
350 TARG_CPU_DEP_rce = $(srcdir)/../opcodes/rce-opc.h
352 TARG_CPU_DEP_sh = $(srcdir)/../opcodes/sh-opc.h
356 TARG_CPU_DEP_w65 = $(srcdir)/../opcodes/w65-opc.h
357 TARG_CPU_DEP_z8k = $(srcdir)/../opcodes/z8k-opc.h
359 gasp.o : gasp.c sb.h macro.h config.h
360 sb.o : sb.c sb.h config.h
361 macro.o : macro.c macro.h sb.h hash.h config.h
362 app.o : app.c write.h
363 as.o : as.c output-file.h write.h subsegs.h sb.h macro.h
364 atof-generic.o : atof-generic.c
365 bignum-copy.o : bignum-copy.c
367 debug.o : debug.c subsegs.h
369 flonum-konst.o : flonum-konst.c
370 flonum-copy.o : flonum-copy.c
371 flonum-mult.o : flonum-mult.c
372 frags.o : frags.c subsegs.h
374 input-file.o : input-file.c input-file.h
375 input-scrub.o : input-scrub.c input-file.h sb.h
376 listing.o : listing.c input-file.h subsegs.h
377 literal.o : literal.c subsegs.h
378 messages.o : messages.c
379 output-file.o : output-file.c output-file.h
380 read.o : read.c sb.h macro.h
381 subsegs.o : subsegs.c subsegs.h
382 symbols.o : symbols.c subsegs.h
383 write.o : write.c subsegs.h output-file.h
384 ecoff.o : ecoff.c ecoff.h \
385 $(srcdir)/../include/coff/internal.h $(srcdir)/../include/coff/sym.h \
386 $(srcdir)/../include/coff/ecoff.h \
387 $(srcdir)/../include/coff/symconst.h \
388 $(srcdir)/../include/aout/stab_gnu.h
389 stabs.o : stabs.c subsegs.h $(srcdir)/../include/aout/stab_gnu.h
390 atof-targ.o : atof-targ.c
391 obj-format.o : obj-format.c
392 targ-cpu.o : targ-cpu.c $(TARG_CPU_DEP_@target_cpu_type@)
394 obj-elf.o : $(srcdir)/config/obj-elf.c
395 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-elf.c
396 obj-ecoff.o : $(srcdir)/config/obj-ecoff.c
397 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-ecoff.c
399 e-mipself.o : $(srcdir)/config/e-mipself.c
400 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-mipself.c
401 e-mipsecoff.o : $(srcdir)/config/e-mipsecoff.c
402 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-mipsecoff.c
404 # The m68k operand parser.
406 m68k-parse.c: $(srcdir)/config/m68k-parse.y
407 $(BISON) $(BISONFLAGS) $(srcdir)/config/m68k-parse.y
408 mv -f y.tab.c m68k-parse.c
409 m68k-parse.o: m68k-parse.c $(srcdir)/config/m68k-parse.h
411 # Remake the info files.
413 doc: $(srcdir)/as.info
415 $(srcdir)/as.info: $(srcdir)/doc/as.texinfo
416 @(cd doc; $(MAKE) $(FLAGS_TO_PASS) as.info; mv as.info $srcdir)
418 diststuff: $(DISTSTUFF) info
421 -rm -f $(STAGESTUFF) core stamp-mk.com
422 -rm -f testsuite/*.o testsuite/*.out \
423 testsuite/gas.log testsuite/gas.sum testsuite/site.exp
425 clean mostlyclean: clean-here
426 @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@
428 # Like clean but also delete the links made to configure gas.
429 distclean: clean-here
430 @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@
431 -rm -f config.status Makefile targ-env.h targ-cpu.h \
432 targ-cpu.c obj-format.h obj-format.c atof-targ.c TAGS \
433 config-stamp config.h conf config.log config.cache .gdbinit \
434 testsuite/Makefile testsuite/config.status
435 maintainer-clean realclean: clean distclean clean-info
436 @echo "This command is intended for maintainers to use;"
437 @echo "it deletes files that may require special tools to rebuild."
440 # Entry points `install', `includes' and `uninstall'.
442 # Copy the files into directories where they will be run.
444 srcroot=`cd $(srcroot); pwd`; export srcroot; \
445 $(INSTALL_XFORM) as.new $(bindir)/as; \
446 $(INSTALL_XFORM1) $(srcdir)/doc/as.1 $(man1dir)/as.1; \
447 n=`echo as | sed '$(program_transform_name)'`; \
448 if [ -d $(tooldir) ]; then \
449 if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \
450 rm -f $(tooldir)/bin/as; \
451 ln $(bindir)/$$n $(tooldir)/bin/as >/dev/null 2>/dev/null \
452 || $(INSTALL_PROGRAM) as.new $(tooldir)/bin/as; \
454 srcroot=`cd $(srcroot); pwd`; export srcroot; \
455 $(INSTALL_XFORM) gasp.new $(bindir)/gasp
457 # Cancel installation by deleting the installed files.
459 -n=`t='$(program_transform_name)'; echo as | sed $$t`; \
460 rm -f $(bindir)/$$n; \
461 rm -f $(mandir)/$$n.1
462 -n=`t='$(program_transform_name)'; echo gasp | sed $$t`; \
463 rm -f $(bindir)/$$n; \
465 # These exist for maintenance purposes.
468 etags $(REAL_HEADERS) $(REAL_SOURCES) $(srcdir)/config/*.[hc] $(srcdir)/README $(srcdir)/Makefile.in
470 bootstrap: as.new force
472 rm -f stage && ln -s stage1 stage
473 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
475 rm -f stage && ln -s stage2 stage
476 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
477 $(MAKE) comparison against=stage2
480 rm -f stage && ln -s stage1 stage
481 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
483 rm -f stage && ln -s stage2 stage
484 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
485 $(MAKE) comparison against=stage2
488 rm -f stage && ln -s stage2 stage
489 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
490 $(MAKE) comparison against=stage2
492 # Copy the object files from a particular stage into a subdirectory.
495 -mv $(STAGESTUFF) stage1
496 if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi
500 -mv $(STAGESTUFF) stage2
501 if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi
505 -mv $(STAGESTUFF) stage3
506 if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi
510 # This rule is derived from corresponding code in the Makefile.in for gcc.
511 # The "tail +16c" is to bypass headers which may include timestamps or
512 # temporary assembly file names.
515 for file in *.o ; do \
516 tail +16c ./$$file > tmp-foo1; \
517 if tail +16c ${against}/$$file > tmp-foo2 2>/dev/null ; then \
518 if cmp tmp-foo1 tmp-foo2 ; then \
521 echo $$file differs ; \
530 - (cd stage1 ; rm -f as ; mv -f * ..)
534 - (cd stage2 ; rm -f as ; mv -f * ..)
538 - (cd stage3 ; rm -f as ; mv -f * ..)
541 #In GNU Make, ignore whether `stage*' exists.
542 .PHONY: stage1 stage2 stage3 stage4 clean mostlyclean realclean distclean
543 .PHONY: TAGS bootstrap
547 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) \
548 $(srcdir)/configure.in config.status conf.in
549 $(SHELL) ./config.status
550 .gdbinit: $(srcdir)/gdbinit.in config.status
551 $(SHELL) ./config.status