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@
39 tooldir = $(exec_prefix)/$(target_alias)
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
53 includedir = @includedir@
59 INSTALL = $${srcroot}/install.sh -c
60 INSTALL_PROGRAM = @INSTALL_PROGRAM@
61 INSTALL_DATA = @INSTALL_DATA@
62 INSTALL_XFORM = $(INSTALL) -t='$(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 RPATH_ENVVAR = @RPATH_ENVVAR@
83 EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
84 echo $${rootme}/../expect/expect ; \
85 else echo expect ; fi`
89 "exec_prefix=$(exec_prefix)" \
90 "tooldir=$(tooldir)" \
92 "AR_FLAGS=$(AR_FLAGS)" \
96 "LOADLIBES=$(LOADLIBES)" \
97 "LDFLAGS=$(LDFLAGS)" \
100 "MAKEINFO=$(MAKEINFO)" \
101 "INSTALL=$(INSTALL)" \
102 "INSTALL_DATA=$(INSTALL_DATA)" \
103 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
105 RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
106 echo $${srcdir}/../dejagnu/runtest ; else echo runtest; \
110 # Lists of files for various purposes.
115 $(srcdir)/atof-generic.c \
116 $(srcdir)/bignum-copy.c \
119 $(srcdir)/flonum-konst.c \
120 $(srcdir)/flonum-copy.c \
121 $(srcdir)/flonum-mult.c \
124 $(srcdir)/input-file.c \
125 $(srcdir)/input-scrub.c \
126 $(srcdir)/literal.c \
127 $(srcdir)/messages.c \
128 $(srcdir)/output-file.c \
130 $(srcdir)/subsegs.c \
131 $(srcdir)/symbols.c \
133 $(srcdir)/listing.c \
137 # in an expedient order
143 SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES)
152 $(srcdir)/input-file.h \
153 $(srcdir)/listing.h \
157 $(srcdir)/struc-symbol.h \
158 $(srcdir)/subsegs.h \
159 $(srcdir)/symbols.h \
169 HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS)
213 all: .gdbinit as.new gasp.new
214 @srcroot=`cd $(srcroot); pwd`; export srcroot; \
215 (cd doc ; $(MAKE) $(FLAGS_TO_PASS) all)
217 dvi info install-info clean-info:
218 @srcroot=`cd $(srcroot); pwd`; export srcroot; \
219 (cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@)
221 make-gas.com: stamp-mk.com
222 stamp-mk.com: vmsconf.sh Makefile
223 sh $(srcdir)/vmsconf.sh $(OBJS) > new-make.com
224 $(srcdir)/../move-if-change new-make.com $(srcdir)/make-gas.com
227 # Now figure out from those variables how to compile and link.
229 # This is the variable actually used when we compile.
230 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CROSS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
232 # How to link with both our special library facilities
233 # and the system's installed libraries.
235 LIBDEPS = @OPCODES_DEP@ @BFDDEP@ $(LOCAL_LOADLIBES) ../libiberty/libiberty.a
236 LIBS = @OPCODES_LIB@ @BFDLIB@ $(LOCAL_LOADLIBES) ../libiberty/libiberty.a
238 # Specify the directories to be searched for header files.
239 # Both . and srcdir are used, in that order,
240 # so that tm.h and config.h will be found in the compilation
241 # subdirectory rather than in the source directory.
242 INCLUDES = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(srcdir)/../include -I$(srcdir)/.. -I$(srcdir)/../bfd
244 # Always use -I$(srcdir)/config when compiling.
246 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
248 # This tells GNU make version 3 not to export all the variables
249 # defined in this file into the environment.
252 # Files to be copied away after each stage in building.
253 STAGESTUFF = *.o as.new gasp.new
255 $(OBJS): @ALL_OBJ_DEPS@
257 as.new: $(OBJS) $(LIBDEPS)
258 $(HLDENV) $(CC) $(HLDFLAGS) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES)
260 $(OBJS): config.h as.h targ-env.h obj-format.h targ-cpu.h flonum.h expr.h \
261 struc-symbol.h write.h frags.h hash.h read.h symbols.h tc.h obj.h \
262 listing.h bignum.h $(srcdir)/../include/libiberty.h
264 gasp.new: $(GASPOBJS) ../libiberty/libiberty.a
265 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gasp.new $(GASPOBJS) ../libiberty/libiberty.a $(LOADLIBES)
268 @echo No installcheck target is available yet for the GNU assembler.
271 @echo "Making a new config file..."
274 -@mv site.exp site.bak
275 @echo "## these variables are automatically generated by make ##" > ./tmp0
276 @echo "# Do not edit here. If you wish to override these values," >> ./tmp0
277 @echo "# do so in the last section." >> ./tmp0
278 @echo set host_os @host_os@ >> ./tmp0
279 @echo set host_alias @host_alias@ >> ./tmp0
280 @echo set host_cpu @host_cpu@ >> ./tmp0
281 @echo set host_vendor @host_vendor@ >> ./tmp0
282 @echo set target_os @target_os@ >> ./tmp0
283 @echo set target_alias @target_alias@ >> ./tmp0
284 @echo set target_cpu @target_cpu@ >> ./tmp0
285 @echo set target_vendor @target_vendor@ >> ./tmp0
286 @echo set host_triplet @host@ >> ./tmp0
287 @echo set target_triplet @target@ >> ./tmp0
288 @echo set target_canonical @target@ >> ./tmp0
289 @echo set srcdir ${srcdir}/testsuite >> ./tmp0
290 @echo set exec_prefix ${exec_prefix} >> ./tmp0
291 @echo set objdir `pwd` >> ./tmp0
292 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
293 @sed -e '1,/^## All variables above are.*##/ d' < site.bak >> ./tmp0
294 @mv -f ./tmp0 site.exp
297 if [ -d testsuite ]; then \
302 rm -f testsuite/site.exp
303 cp site.exp testsuite/site.exp
304 rootme=`pwd`; export rootme; \
305 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
306 $(RPATH_ENVVAR)=$$rootme/../bfd:$$rootme/../opcodes:$$$(RPATH_ENVVAR); \
307 export $(RPATH_ENVVAR); \
309 EXPECT=${EXPECT} ; export EXPECT ; \
310 if [ -f $${rootme}/../expect/expect ] ; then \
311 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
312 export TCL_LIBRARY ; fi ; \
313 $(RUNTEST) --tool gas --srcdir $${srcdir}/testsuite $(RUNTESTFLAGS)
315 config.status: configure
316 $(SHELL) config.status --recheck
318 config.h: config-stamp ; @true
319 config-stamp: Makefile conf
320 -rm -f config.new config-stamp
321 echo '/* config.h. Generated automatically by make. */' > config.new
322 echo '#ifndef GAS_VERSION' >> config.new
323 echo '#define GAS_VERSION "$(VERSION)"' >> config.new
324 echo '' >> config.new
325 cat conf >> config.new
326 echo '#endif /* GAS_VERSION */' >> config.new
327 $(srcdir)/../move-if-change config.new config.h
330 # Compiling object files from source files.
333 TARG_CPU_DEP_alpha = $(srcdir)/../include/opcode/alpha.h subsegs.h
335 TARG_CPU_DEP_arc = $(srcdir)/../include/opcode/arc.h subsegs.h
337 TARG_CPU_DEP_arm = subsegs.h
338 TARG_CPU_DEP_generic =
339 TARG_CPU_DEP_h8300 = $(srcdir)/../include/opcode/h8300.h
340 TARG_CPU_DEP_h8500 = $(srcdir)/../opcodes/h8500-opc.h subsegs.h
341 TARG_CPU_DEP_hppa = subsegs.h
342 TARG_CPU_DEP_i386 = $(srcdir)/../include/opcode/i386.h subsegs.h
345 TARG_CPU_DEP_m68k = $(srcdir)/../include/opcode/m68k.h \
346 $(srcdir)/config/m68k-parse.h subsegs.h
347 TARG_CPU_DEP_m88k = $(srcdir)/config/m88k-opcode.h subsegs.h
348 TARG_CPU_DEP_mips = $(srcdir)/../include/opcode/mips.h subsegs.h
350 TARG_CPU_DEP_ppc = subsegs.h
351 TARG_CPU_DEP_sh = $(srcdir)/../opcodes/sh-opc.h subsegs.h
352 TARG_CPU_DEP_sparc = subsegs.h
355 TARG_CPU_DEP_w65 = $(srcdir)/../opcodes/w65-opc.h subsegs.h
356 TARG_CPU_DEP_z8k = $(srcdir)/../opcodes/z8k-opc.h
358 gasp.o : gasp.c sb.h macro.h config.h
359 sb.o : sb.c sb.h config.h
360 macro.o : macro.c macro.h sb.h hash.h config.h
361 app.o : app.c write.h
362 as.o : as.c output-file.h write.h subsegs.h sb.h macro.h
363 atof-generic.o : atof-generic.c
364 bignum-copy.o : bignum-copy.c
366 debug.o : debug.c subsegs.h
368 flonum-konst.o : flonum-konst.c
369 flonum-copy.o : flonum-copy.c
370 flonum-mult.o : flonum-mult.c
371 frags.o : frags.c subsegs.h
373 input-file.o : input-file.c input-file.h
374 input-scrub.o : input-scrub.c input-file.h sb.h
375 listing.o : listing.c input-file.h subsegs.h
376 literal.o : literal.c subsegs.h
377 messages.o : messages.c
378 output-file.o : output-file.c output-file.h
379 read.o : read.c sb.h macro.h
380 subsegs.o : subsegs.c subsegs.h
381 symbols.o : symbols.c subsegs.h
382 write.o : write.c subsegs.h output-file.h
383 ecoff.o : ecoff.c ecoff.h \
384 $(srcdir)/../include/coff/internal.h $(srcdir)/../include/coff/sym.h \
385 $(srcdir)/../include/coff/ecoff.h \
386 $(srcdir)/../include/coff/symconst.h \
387 $(srcdir)/../include/aout/stab_gnu.h
388 stabs.o : stabs.c subsegs.h $(srcdir)/../include/aout/stab_gnu.h
389 atof-targ.o : atof-targ.c
390 obj-format.o : obj-format.c
391 targ-cpu.o : targ-cpu.c $(TARG_CPU_DEP_@target_cpu_type@)
393 obj-elf.o : $(srcdir)/config/obj-elf.c
394 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-elf.c
395 obj-ecoff.o : $(srcdir)/config/obj-ecoff.c
396 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/obj-ecoff.c
398 e-mipself.o : $(srcdir)/config/e-mipself.c
399 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-mipself.c
400 e-mipsecoff.o : $(srcdir)/config/e-mipsecoff.c
401 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $(srcdir)/config/e-mipsecoff.c
403 # The m68k operand parser.
405 m68k-parse.c: $(srcdir)/config/m68k-parse.y
406 $(BISON) $(BISONFLAGS) $(srcdir)/config/m68k-parse.y
407 mv -f y.tab.c m68k-parse.c
408 m68k-parse.o: m68k-parse.c $(srcdir)/config/m68k-parse.h
410 # Remake the info files.
412 doc: $(srcdir)/as.info
414 $(srcdir)/as.info: $(srcdir)/doc/as.texinfo
415 @(cd doc; $(MAKE) $(FLAGS_TO_PASS) as.info; mv as.info $srcdir)
417 diststuff: $(DISTSTUFF) info
420 -rm -f $(STAGESTUFF) core stamp-mk.com
421 -rm -f testsuite/*.o testsuite/*.out \
422 testsuite/gas.log testsuite/gas.sum testsuite/site.exp
424 clean mostlyclean: clean-here
425 @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@
427 # Like clean but also delete the links made to configure gas.
429 DISTCLEAN_HERE = config.status Makefile targ-env.h targ-cpu.h \
430 targ-cpu.c obj-format.h obj-format.c atof-targ.c TAGS \
431 config-stamp config.h conf config.log config.cache .gdbinit \
432 testsuite/Makefile testsuite/config.status
434 distclean: clean-here
435 @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@
436 -rm -f $(DISTCLEAN_HERE)
438 maintainer-clean realclean: clean-here
439 @echo "This command is intended for maintainers to use;"
440 @echo "it deletes files that may require special tools to rebuild."
441 @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@
442 -rm -rf $(DISTCLEAN_HERE) $(DISTSTUFF)
444 # Entry points `install', `includes' and `uninstall'.
446 # Copy the files into directories where they will be run.
448 srcroot=`cd $(srcroot); pwd`; export srcroot; \
449 $(INSTALL_XFORM) as.new $(bindir)/as; \
450 $(INSTALL_XFORM1) $(srcdir)/doc/as.1 $(man1dir)/as.1; \
451 test -d $(tooldir) || mkdir $(tooldir); \
452 test -d $(tooldir)/bin || mkdir $(tooldir)/bin; \
453 n=`echo as | sed '$(program_transform_name)'`; \
454 rm -f $(tooldir)/bin/as; \
455 ln $(bindir)/$$n $(tooldir)/bin/as >/dev/null 2>/dev/null \
456 || $(INSTALL_PROGRAM) as.new $(tooldir)/bin/as
457 srcroot=`cd $(srcroot); pwd`; export srcroot; \
458 $(INSTALL_XFORM) gasp.new $(bindir)/gasp
460 # Cancel installation by deleting the installed files.
462 -n=`t='$(program_transform_name)'; echo as | sed $$t`; \
463 rm -f $(bindir)/$$n; \
464 rm -f $(mandir)/$$n.1
465 -n=`t='$(program_transform_name)'; echo gasp | sed $$t`; \
466 rm -f $(bindir)/$$n; \
468 # These exist for maintenance purposes.
471 etags $(REAL_HEADERS) $(REAL_SOURCES) $(srcdir)/config/*.[hc] $(srcdir)/README $(srcdir)/Makefile.in
473 bootstrap: as.new force
475 rm -f stage && ln -s stage1 stage
476 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
478 rm -f stage && ln -s stage2 stage
479 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
480 $(MAKE) comparison against=stage2
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 stage2 stage
492 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
493 $(MAKE) comparison against=stage2
495 # Copy the object files from a particular stage into a subdirectory.
498 -mv $(STAGESTUFF) stage1
499 if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi
503 -mv $(STAGESTUFF) stage2
504 if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi
508 -mv $(STAGESTUFF) stage3
509 if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi
513 # This rule is derived from corresponding code in the Makefile.in for gcc.
514 # The "tail +16c" is to bypass headers which may include timestamps or
515 # temporary assembly file names.
518 for file in *.o ; do \
519 tail +16c ./$$file > tmp-foo1; \
520 if tail +16c ${against}/$$file > tmp-foo2 2>/dev/null ; then \
521 if cmp tmp-foo1 tmp-foo2 ; then \
524 echo $$file differs ; \
533 - (cd stage1 ; rm -f as ; mv -f * ..)
537 - (cd stage2 ; rm -f as ; mv -f * ..)
541 - (cd stage3 ; rm -f as ; mv -f * ..)
544 #In GNU Make, ignore whether `stage*' exists.
545 .PHONY: stage1 stage2 stage3 stage4 clean mostlyclean realclean distclean
546 .PHONY: TAGS bootstrap
550 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) \
551 $(srcdir)/configure.in config.status conf.in
552 $(SHELL) ./config.status
553 .gdbinit: $(srcdir)/gdbinit.in config.status
554 $(SHELL) ./config.status