1 # Makefile for GNU Assembler
2 # Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 1996
3 # Free Software Foundation, Inc.
5 # This file is part of GNU GAS.
7 # GNU GAS is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # GNU GAS is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU GAS; see the file COPYING. If not, write to
19 # the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 # The targets for external use include:
22 # all, doc, proto, install, uninstall, includes, TAGS,
23 # clean, mostlyclean, distclean, realclean, stage1, stage2, stage3, stage4.
25 # Variables that exist for you to override.
26 # See below for how to change them for certain systems.
30 srcroot = $(srcdir)/..
32 target_alias = @target_alias@
35 program_transform_name = @program_transform_name@
36 exec_prefix = @exec_prefix@
37 bindir = $(exec_prefix)/bin
38 libdir = $(exec_prefix)/lib
39 tooldir = $(exec_prefix)/$(target_alias)
41 datadir = $(prefix)/lib
42 mandir = $(prefix)/man
43 man1dir = $(mandir)/man1
44 man2dir = $(mandir)/man2
45 man3dir = $(mandir)/man3
46 man4dir = $(mandir)/man4
47 man5dir = $(mandir)/man5
48 man6dir = $(mandir)/man6
49 man7dir = $(mandir)/man7
50 man8dir = $(mandir)/man8
51 man9dir = $(mandir)/man9
52 infodir = $(prefix)/info
53 includedir = $(prefix)/include
54 docdir = $(datadir)/doc
60 INSTALL = $${srcroot}/install.sh -c
61 INSTALL_PROGRAM = $(INSTALL)
62 INSTALL_DATA = $(INSTALL)
63 INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
64 INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1
66 DISTSTUFF= make-gas.com m68k-parse.c
70 BISON = `if [ -f ../bison/bison ] ; then echo ../bison/bison -y -L../bison/bison ; else echo bison -y ; fi`
82 EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
83 echo $${rootme}/../expect/expect ; \
84 else echo expect ; fi`
88 "exec_prefix=$(exec_prefix)" \
89 "tooldir=$(tooldir)" \
91 "AR_FLAGS=$(AR_FLAGS)" \
95 "LOADLIBES=$(LOADLIBES)" \
96 "LDFLAGS=$(LDFLAGS)" \
99 "MAKEINFO=$(MAKEINFO)" \
100 "INSTALL=$(INSTALL)" \
101 "INSTALL_DATA=$(INSTALL_DATA)" \
102 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
104 RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
105 echo $${srcdir}/../dejagnu/runtest ; else echo runtest; \
109 # Lists of files for various purposes.
114 $(srcdir)/atof-generic.c \
115 $(srcdir)/bignum-copy.c \
118 $(srcdir)/flonum-konst.c \
119 $(srcdir)/flonum-copy.c \
120 $(srcdir)/flonum-mult.c \
123 $(srcdir)/input-file.c \
124 $(srcdir)/input-scrub.c \
125 $(srcdir)/literal.c \
126 $(srcdir)/messages.c \
127 $(srcdir)/output-file.c \
129 $(srcdir)/subsegs.c \
130 $(srcdir)/symbols.c \
132 $(srcdir)/listing.c \
136 # in an expedient order
142 SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES)
151 $(srcdir)/input-file.h \
152 $(srcdir)/listing.h \
156 $(srcdir)/struc-symbol.h \
157 $(srcdir)/subsegs.h \
158 $(srcdir)/symbols.h \
168 HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS)
212 all: .gdbinit as.new gasp.new
213 @srcroot=`cd $(srcroot); pwd`; export srcroot; \
214 (cd doc ; $(MAKE) $(FLAGS_TO_PASS) all)
216 dvi info install-info clean-info:
217 @srcroot=`cd $(srcroot); pwd`; export srcroot; \
218 (cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@)
220 make-gas.com: stamp-mk.com
221 stamp-mk.com: vmsconf.sh Makefile
222 sh $(srcdir)/vmsconf.sh $(OBJS) > new-make.com
223 $(srcdir)/../move-if-change new-make.com $(srcdir)/make-gas.com
226 # Now figure out from those variables how to compile and link.
228 # This is the variable actually used when we compile.
229 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CROSS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
231 # How to link with both our special library facilities
232 # and the system's installed libraries.
234 LIBDEPS = @OPCODES_DEP@ @BFDDEP@ $(LOCAL_LOADLIBES) ../libiberty/libiberty.a
235 LIBS = @OPCODES_LIB@ @BFDLIB@ $(LOCAL_LOADLIBES) ../libiberty/libiberty.a
237 # Specify the directories to be searched for header files.
238 # Both . and srcdir are used, in that order,
239 # so that tm.h and config.h will be found in the compilation
240 # subdirectory rather than in the source directory.
241 INCLUDES = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(srcdir)/../include -I$(srcdir)/.. -I$(srcdir)/../bfd
243 # Always use -I$(srcdir)/config when compiling.
245 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
247 # This tells GNU make version 3 not to export all the variables
248 # defined in this file into the environment.
251 # Files to be copied away after each stage in building.
252 STAGESTUFF = *.o as.new gasp.new
254 $(OBJS): @ALL_OBJ_DEPS@
256 as.new: $(OBJS) $(LIBDEPS)
257 $(CC) $(HLDFLAGS) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES)
259 $(OBJS): config.h as.h targ-env.h obj-format.h targ-cpu.h flonum.h expr.h \
260 struc-symbol.h write.h frags.h hash.h read.h symbols.h tc.h obj.h \
263 gasp.new: $(GASPOBJS) ../libiberty/libiberty.a
264 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gasp.new $(GASPOBJS) ../libiberty/libiberty.a $(LOADLIBES)
267 @echo No installcheck target is available yet for the GNU assembler.
270 @echo "Making a new config file..."
273 -@mv site.exp site.bak
274 @echo "## these variables are automatically generated by make ##" > ./tmp0
275 @echo "# Do not edit here. If you wish to override these values," >> ./tmp0
276 @echo "# do so in the last section." >> ./tmp0
277 @echo set host_os @host_os@ >> ./tmp0
278 @echo set host_alias @host_alias@ >> ./tmp0
279 @echo set host_cpu @host_cpu@ >> ./tmp0
280 @echo set host_vendor @host_vendor@ >> ./tmp0
281 @echo set target_os @target_os@ >> ./tmp0
282 @echo set target_alias @target_alias@ >> ./tmp0
283 @echo set target_cpu @target_cpu@ >> ./tmp0
284 @echo set target_vendor @target_vendor@ >> ./tmp0
285 @echo set host_triplet @host@ >> ./tmp0
286 @echo set target_triplet @target@ >> ./tmp0
287 @echo set target_canonical @target@ >> ./tmp0
288 @echo set srcdir ${srcdir}/testsuite >> ./tmp0
289 @echo set exec_prefix ${exec_prefix} >> ./tmp0
290 @echo set objdir `pwd` >> ./tmp0
291 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
292 @sed -e '1,/^## All variables above are.*##/ d' < site.bak >> ./tmp0
293 @mv -f ./tmp0 site.exp
296 if [ -d testsuite ]; then \
301 rm -f testsuite/site.exp
302 cp site.exp testsuite/site.exp
303 rootme=`pwd`; export rootme; \
304 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
305 LD_LIBRARY_PATH=$$rootme/../bfd:$$rootme/../opcodes:$$LD_LIBRARY_PATH; \
306 export LD_LIBRARY_PATH; \
308 EXPECT=${EXPECT} ; export EXPECT ; \
309 if [ -f $${rootme}/../expect/expect ] ; then \
310 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
311 export TCL_LIBRARY ; fi ; \
312 $(RUNTEST) --tool gas --srcdir $${srcdir}/testsuite $(RUNTESTFLAGS)
314 config.status: configure
315 if [ -r config.status ]; then \
316 sh ./config.status --recheck ; \
318 echo You must configure gas. Look at the INSTALL file for details. ; \
322 config.h: config-stamp ; @true
323 config-stamp: Makefile conf
324 -rm -f config.new config-stamp
325 echo '/* config.h. Generated automatically by make. */' > config.new
326 echo '#ifndef GAS_VERSION' >> config.new
327 echo '#define GAS_VERSION "$(VERSION)"' >> config.new
328 echo '' >> config.new
329 cat conf >> config.new
330 echo '#endif /* GAS_VERSION */' >> config.new
331 $(srcdir)/../move-if-change config.new config.h
334 # Compiling object files from source files.
337 TARG_CPU_DEP_alpha = $(srcdir)/config/alpha-opcode.h
339 TARG_CPU_DEP_arc = $(srcdir)/../include/opcode/arc.h
342 TARG_CPU_DEP_generic =
343 TARG_CPU_DEP_h8300 = $(srcdir)/../include/opcode/h8300.h
344 TARG_CPU_DEP_h8500 = $(srcdir)/../opcodes/h8500-opc.h
346 TARG_CPU_DEP_i386 = $(srcdir)/../include/opcode/i386.h
349 TARG_CPU_DEP_m68k = $(srcdir)/../include/opcode/m68k.h \
350 $(srcdir)/config/m68k-parse.h subsegs.h
351 TARG_CPU_DEP_m88k = $(srcdir)/config/m88k-opcode.h
352 TARG_CPU_DEP_mips = $(srcdir)/../include/opcode/mips.h
356 TARG_CPU_DEP_rce = $(srcdir)/../opcodes/rce-opc.h
358 TARG_CPU_DEP_sh = $(srcdir)/../opcodes/sh-opc.h
362 TARG_CPU_DEP_w65 = $(srcdir)/../opcodes/w65-opc.h
363 TARG_CPU_DEP_z8k = $(srcdir)/../opcodes/z8k-opc.h
365 gasp.o : gasp.c sb.h macro.h config.h
366 sb.o : sb.c sb.h config.h
367 macro.o : macro.c macro.h sb.h hash.h config.h
368 app.o : app.c write.h
369 as.o : as.c output-file.h write.h subsegs.h sb.h macro.h
370 atof-generic.o : atof-generic.c
371 bignum-copy.o : bignum-copy.c
373 debug.o : debug.c subsegs.h
375 flonum-konst.o : flonum-konst.c
376 flonum-copy.o : flonum-copy.c
377 flonum-mult.o : flonum-mult.c
378 frags.o : frags.c subsegs.h
380 input-file.o : input-file.c input-file.h
381 input-scrub.o : input-scrub.c input-file.h sb.h
382 listing.o : listing.c input-file.h subsegs.h
383 literal.o : literal.c subsegs.h
384 messages.o : messages.c
385 output-file.o : output-file.c output-file.h
386 read.o : read.c sb.h macro.h
387 subsegs.o : subsegs.c subsegs.h
388 symbols.o : symbols.c subsegs.h
389 write.o : write.c subsegs.h output-file.h
390 ecoff.o : ecoff.c ecoff.h \
391 $(srcdir)/../include/coff/internal.h $(srcdir)/../include/coff/sym.h \
392 $(srcdir)/../include/coff/ecoff.h \
393 $(srcdir)/../include/coff/symconst.h \
394 $(srcdir)/../include/aout/stab_gnu.h
395 stabs.o : stabs.c subsegs.h $(srcdir)/../include/aout/stab_gnu.h
396 atof-targ.o : atof-targ.c
397 obj-format.o : obj-format.c
398 targ-cpu.o : targ-cpu.c $(TARG_CPU_DEP_@target_cpu_type@)
400 obj-elf.o : $(srcdir)/config/obj-elf.c
401 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-elf.c
402 obj-ecoff.o : $(srcdir)/config/obj-ecoff.c
403 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-ecoff.c
405 e-mipself.o : $(srcdir)/config/e-mipself.c
406 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-mipself.c
407 e-mipsecoff.o : $(srcdir)/config/e-mipsecoff.c
408 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-mipsecoff.c
410 # The m68k operand parser.
412 m68k-parse.c: $(srcdir)/config/m68k-parse.y
413 $(BISON) $(BISONFLAGS) $(srcdir)/config/m68k-parse.y
414 mv -f y.tab.c m68k-parse.c
415 m68k-parse.o: m68k-parse.c $(srcdir)/config/m68k-parse.h
417 # Remake the info files.
419 doc: $(srcdir)/as.info
421 $(srcdir)/as.info: $(srcdir)/doc/as.texinfo
422 @(cd doc; $(MAKE) $(FLAGS_TO_PASS) as.info; mv as.info $srcdir)
424 diststuff: $(DISTSTUFF) info
427 -rm -f $(STAGESTUFF) core stamp-mk.com
428 -rm -f testsuite/*.o testsuite/*.out \
429 testsuite/gas.log testsuite/gas.sum testsuite/site.exp
431 clean mostlyclean: clean-here
432 @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@
434 # Like clean but also delete the links made to configure gas.
436 DISTCLEAN_HERE = config.status Makefile targ-env.h targ-cpu.h \
437 targ-cpu.c obj-format.h obj-format.c atof-targ.c TAGS \
438 config-stamp config.h conf config.log config.cache .gdbinit \
439 testsuite/Makefile testsuite/config.status
441 distclean: clean-here
442 @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@
443 -rm -f $(DISTCLEAN_HERE)
445 maintainer-clean realclean: clean-here
446 @echo "This command is intended for maintainers to use;"
447 @echo "it deletes files that may require special tools to rebuild."
448 @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@
449 -rm -rf $(DISTCLEAN_HERE) $(DISTSTUFF)
451 # Entry points `install', `includes' and `uninstall'.
453 # Copy the files into directories where they will be run.
455 srcroot=`cd $(srcroot); pwd`; export srcroot; \
456 $(INSTALL_XFORM) as.new $(bindir)/as; \
457 $(INSTALL_XFORM1) $(srcdir)/doc/as.1 $(man1dir)/as.1; \
458 n=`echo as | sed '$(program_transform_name)'`; \
459 if [ -d $(tooldir) ]; then \
460 if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \
461 rm -f $(tooldir)/bin/as; \
462 ln $(bindir)/$$n $(tooldir)/bin/as >/dev/null 2>/dev/null \
463 || $(INSTALL_PROGRAM) as.new $(tooldir)/bin/as; \
465 srcroot=`cd $(srcroot); pwd`; export srcroot; \
466 $(INSTALL_XFORM) gasp.new $(bindir)/gasp
468 # Cancel installation by deleting the installed files.
470 -n=`t='$(program_transform_name)'; echo as | sed $$t`; \
471 rm -f $(bindir)/$$n; \
472 rm -f $(mandir)/$$n.1
473 -n=`t='$(program_transform_name)'; echo gasp | sed $$t`; \
474 rm -f $(bindir)/$$n; \
476 # These exist for maintenance purposes.
479 etags $(REAL_HEADERS) $(REAL_SOURCES) $(srcdir)/config/*.[hc] $(srcdir)/README $(srcdir)/Makefile.in
481 bootstrap: as.new force
483 rm -f stage && ln -s stage1 stage
484 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
486 rm -f stage && ln -s stage2 stage
487 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
488 $(MAKE) comparison against=stage2
491 rm -f stage && ln -s stage1 stage
492 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
494 rm -f stage && ln -s stage2 stage
495 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
496 $(MAKE) comparison against=stage2
499 rm -f stage && ln -s stage2 stage
500 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
501 $(MAKE) comparison against=stage2
503 # Copy the object files from a particular stage into a subdirectory.
506 -mv $(STAGESTUFF) stage1
507 if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi
511 -mv $(STAGESTUFF) stage2
512 if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi
516 -mv $(STAGESTUFF) stage3
517 if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi
521 # This rule is derived from corresponding code in the Makefile.in for gcc.
522 # The "tail +16c" is to bypass headers which may include timestamps or
523 # temporary assembly file names.
526 for file in *.o ; do \
527 tail +16c ./$$file > tmp-foo1; \
528 if tail +16c ${against}/$$file > tmp-foo2 2>/dev/null ; then \
529 if cmp tmp-foo1 tmp-foo2 ; then \
532 echo $$file differs ; \
541 - (cd stage1 ; rm -f as ; mv -f * ..)
545 - (cd stage2 ; rm -f as ; mv -f * ..)
549 - (cd stage3 ; rm -f as ; mv -f * ..)
552 #In GNU Make, ignore whether `stage*' exists.
553 .PHONY: stage1 stage2 stage3 stage4 clean mostlyclean realclean distclean
554 .PHONY: TAGS bootstrap
558 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) \
559 $(srcdir)/configure.in config.status conf.in
560 $(SHELL) ./config.status
561 .gdbinit: $(srcdir)/gdbinit.in config.status
562 $(SHELL) ./config.status