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`
81 "exec_prefix=$(exec_prefix)" \
82 "tooldir=$(tooldir)" \
84 "AR_FLAGS=$(AR_FLAGS)" \
88 "LOADLIBES=$(LOADLIBES)" \
89 "LDFLAGS=$(LDFLAGS)" \
92 "MAKEINFO=$(MAKEINFO)" \
93 "INSTALL=$(INSTALL)" \
94 "INSTALL_DATA=$(INSTALL_DATA)" \
95 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
97 RUNTEST = `if [ -f ${srcdir}/../dejagnu/runtest ] ; then \
98 echo ${srcdir}/../dejagnu/runtest ; else echo runtest; \
102 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
105 # Lists of files for various purposes.
110 $(srcdir)/atof-generic.c \
111 $(srcdir)/bignum-copy.c \
114 $(srcdir)/flonum-konst.c \
115 $(srcdir)/flonum-copy.c \
116 $(srcdir)/flonum-mult.c \
119 $(srcdir)/input-file.c \
120 $(srcdir)/input-scrub.c \
121 $(srcdir)/literal.c \
122 $(srcdir)/messages.c \
123 $(srcdir)/output-file.c \
125 $(srcdir)/subsegs.c \
126 $(srcdir)/symbols.c \
128 $(srcdir)/listing.c \
132 # in an expedient order
138 SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES)
147 $(srcdir)/input-file.h \
148 $(srcdir)/listing.h \
152 $(srcdir)/struc-symbol.h \
153 $(srcdir)/subsegs.h \
154 $(srcdir)/symbols.h \
164 HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS)
198 all: .gdbinit as.new gasp.new
199 @srcroot=`cd $(srcroot); pwd`; export srcroot; \
200 (cd doc ; $(MAKE) $(FLAGS_TO_PASS) all)
202 dvi info install-info clean-info:
203 @srcroot=`cd $(srcroot); pwd`; export srcroot; \
204 (cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@)
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
212 # Now figure out from those variables how to compile and link.
214 # This is the variable actually used when we compile.
215 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CROSS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
217 # How to link with both our special library facilities
218 # and the system's installed libraries.
220 LIBS = @OPCODES_LIB@ @BFDLIB@ $(LOCAL_LOADLIBES) ../libiberty/libiberty.a
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
228 # Always use -I$(srcdir)/config when compiling.
230 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
232 # This tells GNU make version 3 not to export all the variables
233 # defined in this file into the environment.
236 # Files to be copied away after each stage in building.
237 STAGESTUFF = *.o as.new gasp.new
239 $(OBJS): @ALL_OBJ_DEPS@
241 as.new: $(OBJS) $(LIBS)
242 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES)
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 \
249 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gasp.new gasp.o $(LIBS) $(LOADLIBES)
252 @echo No installcheck target is available yet for the GNU assembler.
255 @(here=`pwd` ; export here ; \
256 cd testsuite ; $(MAKE) $(FLAGS_TO_PASS) $(CHECKFLAGS) check)
258 config.status: configure
259 if [ -r config.status ]; then \
260 sh ./config.status --recheck ; \
262 echo You must configure gas. Look at the INSTALL file for details. ; \
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
278 # Compiling object files from source files.
283 TARG_CPU_DEP_arc = $(srcdir)/../include/opcode/arc.h
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
290 TARG_CPU_DEP_i386 = $(srcdir)/../include/opcode/i386.h
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
300 TARG_CPU_DEP_rce = $(srcdir)/../opcodes/rce-opc.h
302 TARG_CPU_DEP_sh = $(srcdir)/../opcodes/sh-opc.h
306 TARG_CPU_DEP_w65 = $(srcdir)/../opcodes/w65-opc.h
307 TARG_CPU_DEP_z8k = $(srcdir)/../opcodes/z8k-opc.h
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
315 debug.o : debug.c subsegs.h
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
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
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@)
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
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
352 # The m68k operand parser.
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
359 # Remake the info files.
361 doc: $(srcdir)/as.info
363 $(srcdir)/as.info: $(srcdir)/doc/as.texinfo
364 @(cd doc; $(MAKE) $(FLAGS_TO_PASS) as.info; mv as.info $srcdir)
366 diststuff: $(DISTSTUFF)
369 -rm -f $(STAGESTUFF) core stamp-mk.com
371 clean mostlyclean: clean-here
372 @cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@
373 @if [ -d testsuite ] ; then \
374 cd testsuite ; $(MAKE) $(FLAGS_TO_PASS) $@ ; \
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) $@ ; \
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
389 # Entry points `install', `includes' and `uninstall'.
391 # Copy the files into directories where they will be run.
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; \
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; \
413 # Cancel installation by deleting the installed files.
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; \
421 # These exist for maintenance purposes.
424 etags $(REAL_HEADERS) $(REAL_SOURCES) $(srcdir)/config/*.[hc] $(srcdir)/README $(srcdir)/Makefile.in
426 bootstrap: as.new force
428 rm -f stage && ln -s stage1 stage
429 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
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
436 rm -f stage && ln -s stage1 stage
437 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new gasp.new
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
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
448 # Copy the object files from a particular stage into a subdirectory.
451 -mv $(STAGESTUFF) stage1
452 if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi
456 -mv $(STAGESTUFF) stage2
457 if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi
461 -mv $(STAGESTUFF) stage3
462 if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi
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.
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 \
477 echo $$file differs ; \
486 - (cd stage1 ; rm -f as ; mv -f * ..)
490 - (cd stage2 ; rm -f as ; mv -f * ..)
494 - (cd stage3 ; rm -f as ; mv -f * ..)
497 #In GNU Make, ignore whether `stage*' exists.
498 .PHONY: stage1 stage2 stage3 stage4 clean mostlyclean realclean distclean
499 .PHONY: TAGS bootstrap
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