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, 675 Mass Ave, Cambridge, MA 02139, USA.
20 # The targets for external use include:
21 # all, doc, proto, install, uninstall, includes, TAGS,
22 # clean, cleanconfig, realclean, stage1, stage2, stage3, stage4.
24 # Variables that exist for you to override.
25 # See below for how to change them for certain systems.
28 srcroot = $(srcdir)/..
32 program_transform_name =
33 exec_prefix = $(prefix)
34 bindir = $(exec_prefix)/bin
35 libdir = $(exec_prefix)/lib
36 tooldir = $(libdir)/$(target_alias)
38 datadir = $(prefix)/lib
39 mandir = $(prefix)/man
40 man1dir = $(mandir)/man1
41 man2dir = $(mandir)/man2
42 man3dir = $(mandir)/man3
43 man4dir = $(mandir)/man4
44 man5dir = $(mandir)/man5
45 man6dir = $(mandir)/man6
46 man7dir = $(mandir)/man7
47 man8dir = $(mandir)/man8
48 man9dir = $(mandir)/man9
49 infodir = $(prefix)/info
50 includedir = $(prefix)/include
51 docdir = $(datadir)/doc
57 INSTALL = $${srcroot}/install.sh -c
58 INSTALL_PROGRAM = $(INSTALL)
59 INSTALL_DATA = $(INSTALL)
60 INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
61 INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1
73 AS_FOR_TARGET = $${here}/as.new
76 if [ -f $${here}/../gcc/Makefile ] ; then \
77 echo $${here}/../gcc/xgcc -B$${here}/../gcc/; \
79 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
82 t='$(program_transform_name)'; echo gcc | sed -e 's/brokensed/brokensed/' $$t; \
87 if [ -f $${here}/../binutils/Makefile ] ; then \
88 echo $${here}/../binutils/nm ; \
90 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
93 t='$(program_transform_name)'; echo nm | sed -e 's/brokensed/brokensed/' $$t ; \
98 OBJDUMP_FOR_TARGET = ` \
99 if [ -f $${here}/../binutils/Makefile ] ; then \
100 echo $${here}/../binutils/objdump ; \
102 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
105 t='$(program_transform_name)'; echo objdump | sed -e 's/brokensed/brokensed/' $$t ; \
111 "exec_prefix=$(exec_prefix)" \
112 "tooldir=$(tooldir)" \
114 "AR_FLAGS=$(AR_FLAGS)" \
118 "LOADLIBES=$(LOADLIBES)" \
119 "LDFLAGS=$(LDFLAGS)" \
122 "MAKEINFO=$(MAKEINFO)" \
123 "INSTALL=$(INSTALL)" \
124 "INSTALL_DATA=$(INSTALL_DATA)" \
125 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
129 "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
130 "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
131 "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
132 "OBJDUMP_FOR_TARGET=$(OBJDUMP_FOR_TARGET)" \
133 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
136 # Lists of files for various purposes.
141 $(srcdir)/atof-generic.c \
142 $(srcdir)/bignum-copy.c \
145 $(srcdir)/flonum-konst.c \
146 $(srcdir)/flonum-copy.c \
147 $(srcdir)/flonum-mult.c \
150 $(srcdir)/hex-value.c \
151 $(srcdir)/input-file.c \
152 $(srcdir)/input-scrub.c \
153 $(srcdir)/literal.c \
154 $(srcdir)/messages.c \
155 $(srcdir)/output-file.c \
157 $(srcdir)/subsegs.c \
158 $(srcdir)/symbols.c \
160 $(srcdir)/listing.c \
165 # in an expedient order
171 SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES)
180 $(srcdir)/input-file.h \
181 $(srcdir)/listing.h \
185 $(srcdir)/struc-symbol.h \
186 $(srcdir)/subsegs.h \
187 $(srcdir)/symbols.h \
200 HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS)
232 #### host, target, and site specific Makefile frags come in here.
235 @srcroot=`cd $(srcroot); pwd`; export srcroot; \
236 (cd doc ; $(MAKE) $(FLAGS_TO_PASS) all)
238 dvi info install-info clean-info:
239 @srcroot=`cd $(srcroot); pwd`; export srcroot; \
240 (cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@)
242 make-gas.com: stamp-mk.com
243 stamp-mk.com: vmsconf.sh Makefile
244 sh $(srcdir)/vmsconf.sh $(OBJS) ../libiberty/obstack.o ../libiberty/strdup.o > new-make.com
245 $(srcdir)/../move-if-change new-make.com $(srcdir)/make-gas.com
248 # Now figure out from those variables how to compile and link.
250 # This is the variable actually used when we compile.
251 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CROSS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
253 # How to link with both our special library facilities
254 # and the system's installed libraries.
256 LIBS = $(OPCODES_LIB) $(BFDLIB) $(LOCAL_LOADLIBES) \
257 ../libiberty/libiberty.a
259 # Specify the directories to be searched for header files.
260 # Both . and srcdir are used, in that order,
261 # so that tm.h and config.h will be found in the compilation
262 # subdirectory rather than in the source directory.
263 INCLUDES = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(srcdir)/../include -I$(srcdir)/..
264 SUBDIR_INCLUDES = -I.. -I$(srcdir) -I$(srcdir)/config
266 # Always use -I$(srcdir)/config when compiling.
268 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
270 # This tells GNU make version 3 not to export all the variables
271 # defined in this file into the environment.
274 # Files to be copied away after each stage in building.
275 STAGESTUFF = *.o as.new gasp.new
277 as.new: $(OBJS) $(LIBS)
278 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES)
281 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gasp.new gasp.o $(LIBS) $(LOADLIBES)
284 @echo No installcheck target is available yet for the GNU assembler.
287 @(here=`pwd` ; export here ; \
288 cd testsuite ; $(MAKE) $(FLAGS_TO_PASS) $(CHECKFLAGS) check)
291 @echo You must configure gas. Look at the INSTALL file for details.
294 config.h: config-stamp ; @true
295 config-stamp: Makefile
296 -rm -f config.new config-stamp
297 echo '#ifndef TARGET_CPU' > config.new
298 echo '#define TARGET_CPU "$(target_cpu)"' >> config.new
299 echo '#define TARGET_ALIAS "$(target_alias)"' >> config.new
300 echo '#define TARGET_CANONICAL "$(target_canonical)"' >> config.new
301 echo '#define GAS_VERSION "$(VERSION)"' >> config.new
302 echo '#$(BFDDEF) BFD_ASSEMBLER' >> config.new
303 echo '#endif /* TARGET_CPU */' >> config.new
304 $(srcdir)/../move-if-change config.new config.h
307 # Compiling object files from source files.
310 app.o : app.c as.h host.h targ-env.h obj-format.h \
311 targ-cpu.h struc-symbol.h \
312 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
313 as.o : as.c as.h host.h targ-env.h obj-format.h output-file.h \
314 targ-cpu.h struc-symbol.h \
315 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h subsegs.h \
317 atof-generic.o : atof-generic.c as.h host.h targ-env.h obj-format.h \
318 targ-cpu.h struc-symbol.h \
319 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
320 bignum-copy.o : bignum-copy.c as.h host.h \
321 targ-env.h obj-format.h \
322 targ-cpu.h struc-symbol.h \
323 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
324 cond.o : cond.c as.h host.h targ-env.h obj-format.h \
325 targ-cpu.h struc-symbol.h \
326 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
328 debug.o : debug.c as.h host.h targ-env.h obj-format.h \
329 targ-cpu.h struc-symbol.h \
330 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
332 expr.o : expr.c as.h host.h targ-env.h obj-format.h \
333 targ-cpu.h struc-symbol.h \
334 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
336 flonum-konst.o : flonum-konst.c flonum.h bignum.h
337 flonum-copy.o : flonum-copy.c as.h host.h targ-env.h obj-format.h \
338 targ-cpu.h struc-symbol.h \
339 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
340 flonum-mult.o : flonum-mult.c flonum.h bignum.h
341 frags.o : frags.c as.h host.h targ-env.h obj-format.h \
342 targ-cpu.h struc-symbol.h \
343 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
345 hash.o : hash.c as.h host.h targ-env.h obj-format.h \
346 targ-cpu.h struc-symbol.h \
347 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
348 hex-value.o : hex-value.c
349 input-file.o : input-file.c as.h host.h \
350 targ-env.h obj-format.h targ-cpu.h \
351 struc-symbol.h write.h flonum.h bignum.h expr.h \
352 frags.h hash.h read.h symbols.h tc.h obj.h input-file.h
353 input-scrub.o : input-scrub.c /usr/include/errno.h /usr/include/sys/errno.h \
354 as.h host.h targ-env.h obj-format.h \
355 targ-cpu.h struc-symbol.h \
356 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
358 listing.o : listing.c as.h host.h targ-env.h flonum.h bignum.h \
359 listing.h obj-format.h targ-cpu.h struc-symbol.h write.h expr.h \
360 frags.h hash.h read.h symbols.h tc.h obj.h input-file.h subsegs.h
361 literal.o : literal.c subsegs.h as.h host.h targ-env.h obj-format.h \
362 targ-cpu.h struc-symbol.h \
363 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
364 messages.o : messages.c as.h host.h targ-env.h obj-format.h \
365 targ-cpu.h struc-symbol.h \
366 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
367 output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \
368 targ-cpu.h struc-symbol.h \
369 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
371 read.o : read.c as.h host.h targ-env.h obj-format.h \
372 targ-cpu.h struc-symbol.h \
373 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
374 subsegs.o : subsegs.c as.h host.h targ-env.h obj-format.h \
375 targ-cpu.h struc-symbol.h \
376 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
378 symbols.o : symbols.c as.h host.h targ-env.h obj-format.h \
379 targ-cpu.h struc-symbol.h \
380 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
382 write.o : write.c as.h host.h targ-env.h obj-format.h \
383 targ-cpu.h struc-symbol.h \
384 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
385 subsegs.h output-file.h
386 ecoff.o : ecoff.c as.h host.h targ-env.h obj-format.h \
387 targ-cpu.h struc-symbol.h \
388 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
389 ecoff.h $(srcdir)/../include/coff/internal.h \
390 $(srcdir)/../include/coff/sym.h $(srcdir)/../include/coff/ecoff.h \
391 $(srcdir)/../include/coff/symconst.h $(srcdir)/../include/aout/stab_gnu.h
392 stabs.o : stabs.c as.h host.h targ-env.h obj-format.h \
393 targ-cpu.h struc-symbol.h \
394 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
395 subsegs.h $(srcdir)/../include/aout/stab_gnu.h
396 xmalloc.o : xmalloc.c
397 atof-targ.o : atof-targ.c as.h host.h targ-env.h obj-format.h \
398 targ-cpu.h struc-symbol.h \
399 write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
401 obj-format.o : obj-format.c as.h host.h targ-env.h obj-format.h \
402 targ-cpu.h struc-symbol.h \
403 write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
404 subsegs.h symbols.h tc.h obj.h
405 targ-cpu.o : targ-cpu.c config.h targ-env.h obj-format.h \
406 targ-cpu.h struc-symbol.h \
407 write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
408 symbols.h tc.h obj.h $(TARG_CPU_DEPENDENTS)
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)
418 -rm -f $(STAGESTUFF) core
421 @cd doc ; $(MAKE) $(FLAGS_TO_PASS) clean
422 @if [ -d testsuite ] ; then \
423 cd testsuite ; $(MAKE) $(FLAGS_TO_PASS) clean ; \
426 # Like clean but also delete the links made to configure gas.
427 distclean: clean-here
428 @cd doc ; $(MAKE) $(FLAGS_TO_PASS) distclean
429 @if [ -d testsuite ] ; then \
430 cd testsuite ; $(MAKE) $(FLAGS_TO_PASS) distclean ; \
432 -rm -f config.status Makefile host.h targ-env.h targ-cpu.h \
433 targ-cpu.c obj-format.h obj-format.c atof-targ.c TAGS \
434 config-stamp config.h
436 # Entry points `install', `includes' and `uninstall'.
438 # Copy the files into directories where they will be run.
440 srcroot=`cd $(srcroot); pwd`; export srcroot; \
441 $(INSTALL_XFORM) as.new $(bindir)/as; \
442 $(INSTALL_XFORM1) $(srcdir)/doc/as.1 $(man1dir)/as.1; \
443 n=`t='$(program_transform_name)'; echo as | sed -e "s/brokensed/brokensed/" $$t`; \
444 if [ -d $(tooldir) ]; then \
445 if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \
446 rm -f $(tooldir)/bin/as; \
447 ln $(bindir)/$$n $(tooldir)/bin/as \
448 || $(INSTALL_PROGRAM) as.new $(tooldir)/bin/as; \
450 srcroot=`cd $(srcroot); pwd`; export srcroot; \
451 $(INSTALL_XFORM) gasp.new $(bindir)/gasp; \
452 n=`t='$(program_transform_name)'; echo gasp | sed -e "s/brokensed/brokensed/" $$t`; \
453 if [ -d $(tooldir) ]; then \
454 if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \
455 rm -f $(tooldir)/bin/gasp; \
456 ln $(bindir)/$$n $(tooldir)/bin/gasp \
457 || $(INSTALL_PROGRAM) gasp $(tooldir)/bin/gasp; \
460 # Cancel installation by deleting the installed files.
462 -n=`t='$(program_transform_name)'; echo as | sed -e "s/brokensed/brokensed/" $$t`; \
463 rm -f $(bindir)/$$n; \
464 rm -f $(mandir)/$$n.1
465 -n=`t='$(program_transform_name)'; echo gasp | sed -e "s/brokensed/brokensed/" $$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 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
477 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
478 $(MAKE) comparison against=stage2
481 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
483 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
484 $(MAKE) comparison against=stage2
487 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
488 $(MAKE) comparison against=stage2
490 # Copy the object files from a particular stage into a subdirectory.
493 -mv $(STAGESTUFF) stage1
494 if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi
498 -mv $(STAGESTUFF) stage2
499 if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi
503 -mv $(STAGESTUFF) stage3
504 if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi
509 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
512 - (cd stage1 ; rm as ; mv -f * ..)
516 - (cd stage2 ; rm as ; mv -f * ..)
520 - (cd stage3 ; rm as ; mv -f * ..)
523 #In GNU Make, ignore whether `stage*' exists.
524 .PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
528 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) \
529 $(srcdir)/configure.in
530 $(SHELL) ./config.status