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 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.
22 # The targets for external use include:
23 # all, doc, proto, install, uninstall, includes, TAGS,
24 # clean, cleanconfig, realclean, stage1, stage2, stage3, stage4.
26 # Variables that exist for you to override.
27 # See below for how to change them for certain systems.
33 bindir = $(prefix)/bin
34 datadir = $(prefix)/lib
35 libdir = $(prefix)/lib
36 mandir = $(datadir)/man
37 man1dir = $(mandir)/man1
38 man2dir = $(mandir)/man2
39 man3dir = $(mandir)/man3
40 man4dir = $(mandir)/man4
41 man5dir = $(mandir)/man5
42 man6dir = $(mandir)/man6
43 man7dir = $(mandir)/man7
44 man8dir = $(mandir)/man8
45 man9dir = $(mandir)/man9
46 infodir = $(prefix)/info
47 includedir = $(prefix)/include
48 docdir = $(datadir)/doc
53 INSTALL_PROGRAM = $(INSTALL)
54 INSTALL_DATA = $(INSTALL)
62 # Version of ar to use when compiling gnulib.
65 # Additional system libraries to link with.
68 # Specify the rule for actually making gnulib.
69 GNULIB = gnulib.portable
71 # Specify the rule for actually making gnulib2.
72 GNULIB2 = gnulib2.portable
74 # List of extra C and assembler files to add to gnulib.
75 # Assembler files should have names ending in `.asm'.
78 # Program to convert libraries.
81 # Control whether header files are installed.
82 INSTALL_HEADERS=install-headers
84 # Change this to empty to prevent installing limits.h
87 # Directory to link to, when using the target `maketest'.
90 # For better debugging under COFF, define SEPARATE_AUX_OUTPUT in config.h
91 # and define the following variable as `aux-output2.c' in make-...
94 # Flags to use when cross-building GCC.
95 # Prefix to apply to names of object files when using them
96 # to run on the machine we are compiling on.
98 # Prefix to apply to names of object files when compiling them
99 # to run on the machine we are compiling on.
100 # The default for this variable is chosen to keep these rules
101 # out of the way of the other rules for compiling the same source files.
104 HOST_CFLAGS=$(ALL_CFLAGS)
105 HOST_LDFLAGS=$(LDFLAGS)
106 HOST_CPPFLAGS=$(CPPFLAGS)
108 # Choose the real default target.
111 # End of variables for you to override.
113 # Lists of files for various purposes.
118 $(srcdir)/atof-generic.c \
119 $(srcdir)/bignum-copy.c \
122 $(srcdir)/flonum-const.c \
123 $(srcdir)/flonum-copy.c \
124 $(srcdir)/flonum-mult.c \
127 $(srcdir)/hex-value.c \
128 $(srcdir)/input-file.c \
129 $(srcdir)/input-scrub.c \
130 $(srcdir)/messages.c \
131 $(srcdir)/output-file.c \
134 $(srcdir)/subsegs.c \
135 $(srcdir)/symbols.c \
136 $(srcdir)/version.c \
138 $(srcdir)/xmalloc.c \
141 # in an expedient order
147 SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES)
156 $(srcdir)/input-file.h \
160 $(srcdir)/struc-symbol.h \
161 $(srcdir)/subsegs.h \
162 $(srcdir)/symbols.h \
163 $(srcdir)/syscalls.h \
175 HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS)
206 #### host, target, and site specific Makefile frags come in here.
208 # Definition of `all' is here so that new rules inserted by sed
209 # do not specify the default target.
210 # The real definition is under `all.internal'.
220 # Now figure out from those variables how to compile and link.
222 # This is the variable actually used when we compile.
223 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CFLAGS) $(HDEFINES) $(TDEFINES)
225 # Even if ALLOCA is set, don't use it if compiling with GCC.
226 USE_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${ALLOCA}; else true; fi`
227 USE_HOST_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${HOST_PREFIX}${ALLOCA}; else true; fi`
229 # Likewise, for use in the tools that must run on this machine
230 # even if we are cross-building GCC.
231 # We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
232 HOST_LIBDEPS= $(HOST_PREFIX)$(OBSTACK) $(HOST_PREFIX)$(ALLOCA) $(HOST_PREFIX)$(MALLOC)
234 # How to link with both our special library facilities
235 # and the system's installed libraries.
237 LIBS = $(LOCAL_LOADLIBES) $(CLIB) $(unsubdir)/../libiberty$(subdir)/libiberty.a
239 # Likewise, for use in the tools that must run on this machine
240 # even if we are cross-building GCC.
241 HOST_LIBS = $(HOST_PREFIX)$(OBSTACK) $(USE_HOST_ALLOCA) $(HOST_PREFIX)$(MALLOC) $(CLIB)
243 # Specify the directories to be searched for header files.
244 # Both . and srcdir are used, in that order,
245 # so that tm.h and config.h will be found in the compilation
246 # subdirectory rather than in the source directory.
247 INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config -I$(srcdir)/../include
248 SUBDIR_INCLUDES = -I.. -I$(srcdir) -I$(srcdir)/config
250 # Always use -I$(srcdir)/config when compiling.
252 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
254 # This tells GNU make version 3 not to export all the variables
255 # defined in this file into the environment.
258 # Files to be copied away after each stage in building.
260 STAGESTUFF = *.o as.new
262 # The files that "belong" in CONFIG_H are deliberately omitted
263 # because having them there would not be useful in actual practice.
264 # All they would do is cause complete recompilation every time
265 # one of the machine description files is edited.
266 # That may or may not be what one wants to do.
267 # If it is, rm *.o is an easy way to do it.
268 # CONFIG_H = config.h tm.h
271 as.new: $(OBJS) $(LIBDEPS)
273 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES)
278 # This is what is made with the host's compiler if making a cross assembler.
279 native: config.status as
282 @echo You must configure gas. Look at the INSTALL file for details.
285 compilations: ${OBJS}
287 # Compiling object files from source files.
289 app.o : app.c as.h host.h targ-env.h obj-format.h \
290 targ-cpu.h struc-symbol.h \
291 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
292 as.o : as.c as.h host.h targ-env.h obj-format.h \
293 targ-cpu.h struc-symbol.h \
294 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
295 atof-generic.o : atof-generic.c as.h host.h targ-env.h obj-format.h \
296 targ-cpu.h struc-symbol.h \
297 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
298 bignum-copy.o : bignum-copy.c as.h host.h \
299 targ-env.h obj-format.h \
300 targ-cpu.h struc-symbol.h \
301 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
302 cond.o : cond.c as.h host.h targ-env.h obj-format.h \
303 targ-cpu.h struc-symbol.h \
304 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
306 debug.o : debug.c as.h host.h targ-env.h obj-format.h \
307 targ-cpu.h struc-symbol.h \
308 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
310 expr.o : expr.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 \
314 flonum-const.o : flonum-const.c flonum.h bignum.h
315 flonum-copy.o : flonum-copy.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 flonum-mult.o : flonum-mult.c flonum.h bignum.h
319 frags.o : frags.c as.h host.h targ-env.h obj-format.h \
320 targ-cpu.h struc-symbol.h \
321 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
323 hash.o : hash.c as.h host.h targ-env.h obj-format.h \
324 targ-cpu.h struc-symbol.h \
325 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
326 hex-value.o : hex-value.c
327 input-file.o : input-file.c as.h host.h \
328 targ-env.h obj-format.h targ-cpu.h \
329 struc-symbol.h write.h flonum.h bignum.h expr.h \
330 frags.h hash.h read.h symbols.h tc.h obj.h input-file.h
331 input-scrub.o : input-scrub.c /usr/include/errno.h /usr/include/sys/errno.h \
332 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 messages.o : messages.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
339 obstack.o : obstack.c
340 output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \
341 targ-cpu.h struc-symbol.h \
342 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
344 read.o : read.c as.h host.h targ-env.h obj-format.h \
345 targ-cpu.h struc-symbol.h \
346 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
349 subsegs.o : subsegs.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 \
353 symbols.o : symbols.c as.h host.h targ-env.h obj-format.h \
354 targ-cpu.h struc-symbol.h \
355 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
357 version.o : version.c
358 write.o : write.c 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 \
361 subsegs.h output-file.h
362 xmalloc.o : xmalloc.c
363 xrealloc.o : xrealloc.c
364 atof-targ.o : atof-targ.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 \
368 obj-format.o : obj-format.c as.h host.h targ-env.h obj-format.h \
369 targ-cpu.h struc-symbol.h \
370 write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
372 targ-cpu.o : targ-cpu.c targ-env.h obj-format.h \
373 targ-cpu.h struc-symbol.h \
374 write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
375 symbols.h tc.h obj.h $(TARG_CPU_DEPENDENTS)
378 # Compile the libraries to be used by gen*.
379 # If we are not cross-building, gen* use the same .o's that cc1 will use,
380 # and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
381 # with the rules for rtl.o, alloca.o, etc.
382 $(HOST_PREFIX_1)alloca.o: alloca.c
383 rm -f $(HOST_PREFIX)alloca.c
384 cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
385 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
387 $(HOST_PREFIX_1)obstack.o: obstack.c
388 rm -f $(HOST_PREFIX)obstack.c
389 cp $(srcdir)/obstack.c $(HOST_PREFIX)obstack.c
390 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
392 $(HOST_PREFIX_1)malloc.o: malloc.c
393 rm -f $(HOST_PREFIX)malloc.c
394 cp $(srcdir)/malloc.c $(HOST_PREFIX)malloc.c
395 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
397 # Remake the info files.
399 doc: $(srcdir)/as.info
401 $(srcdir)/as.info: $(srcdir)/doc/as.texinfo
402 (cd doc; make as.info; mv as.info $srcdir)
405 # Deletion of files made during compilation.
406 # There are three levels of this: `clean', `cleanconfig' and `realclean'.
407 # `clean' deletes what you want to delete ordinarily to save space.
408 # This is most, but not all, of the files made by compilation.
409 # `cleanconfig' also deletes everything depending
410 # on the choice of config files.
411 # `realclean' also deletes everything that could be regenerated automatically.
415 # Delete the temporary source copies for cross compilation.
416 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
417 -rm -f $(HOST_PREFIX_1)obstack.c
418 # Delete the stamp files except stamp-gnulib2.
421 # Like clean but also delete the links made to configure gas.
423 -rm -f config.status Makefile host.h targ-env.h
424 -rm -f targ-cpu.h targ-cpu.c
425 -rm -f obj-format.h obj-format.c
428 # Get rid of every file that's generated from some other file (except INSTALL).
429 realclean: cleanconfig
430 -rm -f gas.aux gas.cps gas.fns gas.info gas.kys gas.pgs gas.tps gas.vrs
432 -rm -f gas.info* gas.?? gas.??s gas.log gas.toc gas.*aux
435 # Entry points `install', `includes' and `uninstall'.
437 # Copy the files into directories where they will be run.
439 $(INSTALL_PROGRAM) $(ALL) $(bindir)/as
441 # Create the installation directory.
445 -mkdir $(libdir)/gcc/$(target)
446 -mkdir $(libdir)/gcc/$(target)/$(version)
448 # Install the compiler executables built during cross compilation.
449 install-cross: native install-dir
450 -if [ -f cc1 ] ; then $(INSTALL_PROGRAM) cc1 $(libsubdir)/cc1; else true; fi
451 -if [ -f cc1plus ] ; then $(INSTALL_PROGRAM) cc1plus $(libsubdir)/cc1plus; else true; fi
452 $(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
453 ./gcc -dumpspecs > $(libsubdir)/specs
454 $(INSTALL_PROGRAM) gcc $(bindir)/gcc
456 # Install the man pages.
457 install-man: install-dir $(srcdir)/gcc.1 protoize.1 unprotoize.1
458 $(INSTALL_FILE) $(srcdir)/gcc.1 $(mandir)/gcc.$(manext)
459 chmod a-x $(mandir)/gcc.$(manext)
460 $(INSTALL_FILE) $(srcdir)/protoize.1 $(mandir)/protoize.$(manext)
461 chmod a-x $(mandir)/protoize.$(manext)
462 $(INSTALL_FILE) $(srcdir)/unprotoize.1 $(mandir)/unprotoize.$(manext)
463 chmod a-x $(mandir)/unprotoize.$(manext)
465 # Cancel installation by deleting the installed files.
469 -rm -rf $(mandir)/gas.$(manext)
472 # These exist for maintenance purposes.
475 etags $(REAL_SOURCES) $(REAL_HEADERS) $(srcdir)/README $(srcdir)/Makefile $(srcdir)/config/*.[hc]
477 bootstrap: $(ALL) force
479 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL)
481 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL)
482 $(MAKE) comparison against=stage2
485 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL)
487 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL)
488 $(MAKE) comparison against=stage2
491 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= $(ALL)
492 $(MAKE) comparison against=stage2
494 # Copy the object files from a particular stage into a subdirectory.
497 -mv $(STAGESTUFF) stage1
498 if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi
502 -mv $(STAGESTUFF) stage2
503 if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi
507 -mv $(STAGESTUFF) stage3
508 if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi
513 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
516 - (cd stage1 ; rm as ; mv -f * ..)
520 - (cd stage2 ; rm as ; mv -f * ..)
524 - (cd stage3 ; rm as ; mv -f * ..)
527 # Copy just the executable files from a particular stage into a subdirectory,
528 # and delete the object files. Use this if you're just verifying a version
529 # that is pretty sure to work, and you are short of disk space.
532 -mv cc1 cpp cccp gcc stage1
534 -cp gnulib stage1 && $(RANLIB) stage1/gnulib
539 -mv cc1 cpp cccp gcc stage2
541 -cp gnulib stage2 && $(RANLIB) stage2/gnulib
546 -mv cc1 cpp cccp gcc stage3
548 -cp gnulib stage3 && $(RANLIB) stage3/gnulib
553 -mv cc1 cpp cccp gcc stage4
555 -cp gnulib stage4 && $(RANLIB) stage4/gnulib
558 #In GNU Make, ignore whether `stage*' exists.
559 .PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
560 .PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
564 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
565 $(SHELL) ./config.status