1 # Makefile for GNU Assembler
2 # Copyright (C) 1987, 1988, 1990, 1991 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 1, 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 # $FreeBSD: src/gnu/usr.bin/as/makefile.dos,v 1.4 1999/08/27 23:34:19 peter Exp $
21 # $DragonFly: src/gnu/usr.bin/as/Attic/makefile.dos,v 1.2 2003/06/17 04:25:44 dillon Exp $
23 # The targets for external use include:
24 # all, doc, proto, install, uninstall, includes, TAGS,
25 # clean, cleanconfig, realclean, stage1, stage2, stage3, stage4.
27 # Variables that exist for you to override.
28 # See below for how to change them for certain systems.
36 CFLAGS = -g -D__MSDOS__ -D__GO32__ -I../include
37 INTERNAL_CFLAGS = $(CROSS)
45 # on sysV, define this as cp.
47 # These permit overriding just for certain files.
48 INSTALL_PROGRAM = $(INSTALL)
49 INSTALL_FILE = $(INSTALL)
51 # Define this as & to perform parallel make on a Sequent.
52 # Note that this has some bugs, and it seems currently necessary
53 # to compile all the gen* files first by hand to avoid erroneous results.
56 # How to invoke ranlib.
58 # Test to use to see whether ranlib exists on the system.
59 RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
61 # CFLAGS for use with OLDCC, for compiling gnulib.
62 # NOTE: -O does not work on some Unix systems!
65 # Version of ar to use when compiling gnulib.
68 version=`$(unsubdir)/../gcc$(subdir)/gcc -dumpversion`
70 # Directory where sources are, from where we are.
72 # Common prefix for installation directories.
73 # NOTE: This directory must exist when you start installation.
75 # Directory in which to put the executable for the command `gcc'
76 bindir = $(ddestdir)/bin
77 # Directory in which to put the directories used by the compiler.
78 libdir = $(ddestdir)/lib
79 # Directory in which the compiler finds executables, libraries, etc.
80 libsubdir = $(libdir)/gcc/$(target_alias)/$(version)
81 # Number to put in man-page filename.
83 # Directory in which to put man pages.
84 mandir = $(destdir)/H-independent/man/man$(manext)
86 # Additional system libraries to link with.
89 # Specify the rule for actually making gnulib.
90 GNULIB = gnulib.portable
92 # Specify the rule for actually making gnulib2.
93 GNULIB2 = gnulib2.portable
95 # List of extra C and assembler files to add to gnulib.
96 # Assembler files should have names ending in `.asm'.
99 # Program to convert libraries.
102 # Control whether header files are installed.
103 INSTALL_HEADERS=install-headers
105 # Change this to empty to prevent installing limits.h
108 # Directory to link to, when using the target `maketest'.
111 # For better debugging under COFF, define SEPARATE_AUX_OUTPUT in config.h
112 # and define the following variable as `aux-output2.c' in make-...
115 # Flags to use when cross-building GCC.
116 # Prefix to apply to names of object files when using them
117 # to run on the machine we are compiling on.
119 # Prefix to apply to names of object files when compiling them
120 # to run on the machine we are compiling on.
121 # The default for this variable is chosen to keep these rules
122 # out of the way of the other rules for compiling the same source files.
125 HOST_CFLAGS=$(ALL_CFLAGS)
126 HOST_LDFLAGS=$(LDFLAGS)
127 HOST_CPPFLAGS=$(CPPFLAGS)
129 # Choose the real default target.
132 # End of variables for you to override.
134 # Lists of files for various purposes.
162 # in an expedient order
168 SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES)
196 HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS)
227 #### host, target, and site specific Makefile frags come in here.
228 TARG_CPU_DEPENDENTS=../include/h8300-opcode.h
229 LOCAL_LOADLIBES=../bfd/libbfd.a
230 TDEFINES=-DBFD -DBFD_HEADERS -DMANY_SEGMENTS
233 # Definition of `all' is here so that new rules inserted by sed
234 # do not specify the default target.
235 # The real definition is under `all.internal'.
245 # Now figure out from those variables how to compile and link.
247 # This is the variable actually used when we compile.
248 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
250 # Even if ALLOCA is set, don't use it if compiling with GCC.
251 USE_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${ALLOCA}; else true; fi`
252 USE_HOST_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${HOST_PREFIX}${ALLOCA}; else true; fi`
254 # Likewise, for use in the tools that must run on this machine
255 # even if we are cross-building GCC.
256 # We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
257 HOST_LIBDEPS= $(HOST_PREFIX)$(OBSTACK) $(HOST_PREFIX)$(ALLOCA) $(HOST_PREFIX)$(MALLOC)
259 # How to link with both our special library facilities
260 # and the system's installed libraries.
262 LIBS = $(LOCAL_LOADLIBES) $(CLIB) $(unsubdir)/../libiberty$(subdir)/libiberty.a
264 # Likewise, for use in the tools that must run on this machine
265 # even if we are cross-building GCC.
266 HOST_LIBS = $(HOST_PREFIX)$(OBSTACK) $(USE_HOST_ALLOCA) $(HOST_PREFIX)$(MALLOC) $(CLIB)
268 # Specify the directories to be searched for header files.
269 # Both . and srcdir are used, in that order,
270 # so that tm.h and config.h will be found in the compilation
271 # subdirectory rather than in the source directory.
272 INCLUDES = -I. -I$(srcdir) -Iconfig
273 SUBDIR_INCLUDES = -I.. -I../$(srcdir) -I../config
275 # Always use -Iconfig when compiling.
277 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
279 # This tells GNU make version 3 not to export all the variables
280 # defined in this file into the environment.
283 # Files to be copied away after each stage in building.
285 STAGESTUFF = *.o as.new
287 # The files that "belong" in CONFIG_H are deliberately omitted
288 # because having them there would not be useful in actual practice.
289 # All they would do is cause complete recompilation every time
290 # one of the machine description files is edited.
291 # That may or may not be what one wants to do.
292 # If it is, rm *.o is an easy way to do it.
293 # CONFIG_H = config.h tm.h
296 as.new: $(OBJS) $(LIBDEPS)
298 >as.rf $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES)
304 # This is what is made with the host's compiler if making a cross assembler.
305 native: config.status as
308 @echo You must configure gas. Look at the INSTALL file for details.
311 compilations: ${OBJS}
313 # Compiling object files from source files.
315 app.o : app.c as.h host.h targ-env.h obj-format.h \
316 targ-cpu.h struc-symbol.h \
317 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
318 as.o : as.c as.h host.h targ-env.h obj-format.h \
319 targ-cpu.h struc-symbol.h \
320 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
321 atof-generic.o : atof-generic.c as.h host.h 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 bignum-copy.o : bignum-copy.c as.h host.h \
325 targ-env.h obj-format.h \
326 targ-cpu.h struc-symbol.h \
327 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
328 cond.o : cond.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 debug.o : debug.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 expr.o : expr.c as.h host.h targ-env.h obj-format.h \
337 targ-cpu.h struc-symbol.h \
338 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
340 fn-const.o : fn-const.c flonum.h bignum.h
341 fn-copy.o : fn-copy.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
344 flonum-mult.o : flonum-mult.c flonum.h bignum.h
345 frags.o : frags.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 \
349 hash.o : hash.c as.h host.h targ-env.h obj-format.h \
350 targ-cpu.h struc-symbol.h \
351 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
352 hex-value.o : hex-value.c
353 input-file.o : input-file.c as.h host.h \
354 targ-env.h obj-format.h targ-cpu.h \
355 struc-symbol.h write.h flonum.h bignum.h expr.h \
356 frags.h hash.h read.h symbols.h tc.h obj.h input-file.h
357 input-scrub.o : input-scrub.c \
358 as.h host.h targ-env.h obj-format.h \
359 targ-cpu.h struc-symbol.h \
360 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
362 messages.o : messages.c as.h host.h targ-env.h obj-format.h \
363 targ-cpu.h struc-symbol.h \
364 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
365 obstack.o : obstack.c
366 output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \
367 targ-cpu.h struc-symbol.h \
368 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
370 read.o : read.c as.h host.h targ-env.h obj-format.h \
371 targ-cpu.h struc-symbol.h \
372 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
375 subsegs.o : subsegs.c as.h host.h targ-env.h obj-format.h \
376 targ-cpu.h struc-symbol.h \
377 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
379 symbols.o : symbols.c as.h host.h targ-env.h obj-format.h \
380 targ-cpu.h struc-symbol.h \
381 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
383 version.o : version.c
384 write.o : write.c as.h host.h targ-env.h obj-format.h \
385 targ-cpu.h struc-symbol.h \
386 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
387 subsegs.h output-file.h
388 xmalloc.o : xmalloc.c
389 xrealloc.o : xrealloc.c
390 atof-targ.o : atof-targ.c as.h host.h targ-env.h obj-format.h \
391 targ-cpu.h struc-symbol.h \
392 write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
394 obj-format.o : obj-format.c as.h host.h targ-env.h obj-format.h \
395 targ-cpu.h struc-symbol.h \
396 write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
398 targ-cpu.o : targ-cpu.c targ-env.h obj-format.h \
399 targ-cpu.h struc-symbol.h \
400 write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
401 symbols.h tc.h obj.h $(TARG_CPU_DEPENDENTS)
404 # Compile the libraries to be used by gen*.
405 # If we are not cross-building, gen* use the same .o's that cc1 will use,
406 # and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
407 # with the rules for rtl.o, alloca.o, etc.
408 $(HOST_PREFIX_1)alloca.o: alloca.c
409 rm -f $(HOST_PREFIX)alloca.c
410 cp alloca.c $(HOST_PREFIX)alloca.c
411 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
413 $(HOST_PREFIX_1)obstack.o: obstack.c
414 rm -f $(HOST_PREFIX)obstack.c
415 cp obstack.c $(HOST_PREFIX)obstack.c
416 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
418 $(HOST_PREFIX_1)malloc.o: malloc.c
419 rm -f $(HOST_PREFIX)malloc.c
420 cp malloc.c $(HOST_PREFIX)malloc.c
421 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
423 # Remake the info files.
427 as.info: doc/as.texinfo
428 (cd doc; make as.info; mv as.info $srcdir)
431 # Deletion of files made during compilation.
432 # There are three levels of this: `clean', `cleanconfig' and `realclean'.
433 # `clean' deletes what you want to delete ordinarily to save space.
434 # This is most, but not all, of the files made by compilation.
435 # `cleanconfig' also deletes everything depending
436 # on the choice of config files.
437 # `realclean' also deletes everything that could be regenerated automatically.
441 # Delete the temporary source copies for cross compilation.
442 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
443 -rm -f $(HOST_PREFIX_1)obstack.c
444 # Delete the stamp files except stamp-gnulib2.
447 # Like clean but also delete the links made to configure gas.
449 -rm -f config.status Makefile host.h targ-env.h
450 -rm -f targ-cpu.h targ-cpu.c
451 -rm -f obj-format.h obj-format.c
454 # Get rid of every file that's generated from some other file (except INSTALL).
455 realclean: cleanconfig
456 -rm -f gas.aux gas.cps gas.fns gas.info gas.kys gas.pgs gas.tps gas.vrs
458 -rm -f gas.info* gas.?? gas.??s gas.log gas.toc gas.*aux
461 # Entry points `install', `includes' and `uninstall'.
463 # Copy the files into directories where they will be run.
465 $(INSTALL_PROGRAM) $(ALL) $(libsubdir)/as
466 # cp $(ALL) $(bindir)/as.new
467 # mv -f $(bindir)/as.new $(bindir)/as
469 # Create the installation directory.
473 -mkdir $(libdir)/gcc/$(target)
474 -mkdir $(libdir)/gcc/$(target)/$(version)
476 # Install the compiler executables built during cross compilation.
477 install-cross: native install-dir
478 -if [ -f cc1 ] ; then $(INSTALL_PROGRAM) cc1 $(libsubdir)/cc1; else true; fi
479 -if [ -f cc1plus ] ; then $(INSTALL_PROGRAM) cc1plus $(libsubdir)/cc1plus; else true; fi
480 $(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
481 ./gcc -dumpspecs > $(libsubdir)/specs
482 $(INSTALL_PROGRAM) gcc $(bindir)/gcc
484 # Install the man pages.
485 install-man: install-dir gcc.1 protoize.1 unprotoize.1
486 $(INSTALL_FILE) gcc.1 $(mandir)/gcc.$(manext)
487 chmod a-x $(mandir)/gcc.$(manext)
488 $(INSTALL_FILE) protoize.1 $(mandir)/protoize.$(manext)
489 chmod a-x $(mandir)/protoize.$(manext)
490 $(INSTALL_FILE) unprotoize.1 $(mandir)/unprotoize.$(manext)
491 chmod a-x $(mandir)/unprotoize.$(manext)
493 # Cancel installation by deleting the installed files.
497 -rm -rf $(mandir)/gas.$(manext)
500 # These exist for maintenance purposes.
503 etags $(REAL_SOURCES) $(REAL_HEADERS) README Makefile config/*.[hc]
505 bootstrap: $(ALL) force
507 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL)
509 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL)
510 $(MAKE) comparison against=stage2
513 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL)
515 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL)
516 $(MAKE) comparison against=stage2
519 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL)
520 $(MAKE) comparison against=stage2
522 # Copy the object files from a particular stage into a subdirectory.
525 -mv $(STAGESTUFF) stage1
526 if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi
530 -mv $(STAGESTUFF) stage2
531 if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi
535 -mv $(STAGESTUFF) stage3
536 if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi
541 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
544 - (cd stage1 ; rm as ; mv -f * ..)
548 - (cd stage2 ; rm as ; mv -f * ..)
552 - (cd stage3 ; rm as ; mv -f * ..)
555 # Copy just the executable files from a particular stage into a subdirectory,
556 # and delete the object files. Use this if you're just verifying a version
557 # that is pretty sure to work, and you are short of disk space.
560 -mv cc1 cpp cccp gcc stage1
562 -cp gnulib stage1 && $(RANLIB) stage1/gnulib
567 -mv cc1 cpp cccp gcc stage2
569 -cp gnulib stage2 && $(RANLIB) stage2/gnulib
574 -mv cc1 cpp cccp gcc stage3
576 -cp gnulib stage3 && $(RANLIB) stage3/gnulib
581 -mv cc1 cpp cccp gcc stage4
583 -cp gnulib stage4 && $(RANLIB) stage4/gnulib
586 #In GNU Make, ignore whether `stage*' exists.
587 .PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
588 .PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
592 Makefile: Makefile.in $(host_makefile_frag) $(target_makefile_frag)
593 $(SHELL) ./config.status