1 # Makefile for GNU Assembler
2 # Copyright (C) 1987-1992 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.
31 program_transform_name =
32 exec_prefix = $(prefix)
33 bindir = $(exec_prefix)/bin
34 libdir = $(exec_prefix)/lib
35 tooldir = $(libdir)/$(target_alias)
37 datadir = $(prefix)/lib
38 mandir = $(prefix)/man
39 man1dir = $(mandir)/man1
40 man2dir = $(mandir)/man2
41 man3dir = $(mandir)/man3
42 man4dir = $(mandir)/man4
43 man5dir = $(mandir)/man5
44 man6dir = $(mandir)/man6
45 man7dir = $(mandir)/man7
46 man8dir = $(mandir)/man8
47 man9dir = $(mandir)/man9
48 infodir = $(prefix)/info
49 includedir = $(prefix)/include
50 docdir = $(datadir)/doc
56 INSTALL = `cd $(srcdir)/..;pwd`/install.sh -c
57 INSTALL_PROGRAM = $(INSTALL)
58 INSTALL_DATA = $(INSTALL)
59 INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
60 INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1
70 AS_FOR_TARGET = $${here}/as.new
73 if [ -f $${here}/../gcc/Makefile ] ; then \
74 echo $${here}/../gcc/xgcc -B$${here}/../gcc/; \
76 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
79 t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
84 if [ -f $${here}/../binutils/Makefile ] ; then \
85 echo $${here}/../binutils/nm ; \
87 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
90 t='$(program_transform_name)'; echo nm | sed -e '' $$t ; \
95 OBJDUMP_FOR_TARGET = ` \
96 if [ -f $${here}/../binutils/Makefile ] ; then \
97 echo $${here}/../binutils/objdump ; \
99 if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
102 t='$(program_transform_name)'; echo objdump | sed -e '' $$t ; \
108 "exec_prefix=$(exec_prefix)" \
109 "tooldir=$(tooldir)" \
111 "AR_FLAGS=$(AR_FLAGS)" \
115 "LOADLIBES=$(LOADLIBES)" \
116 "LDFLAGS=$(LDFLAGS)" \
119 "MAKEINFO=$(MAKEINFO)" \
120 "INSTALL=$(INSTALL)" \
121 "INSTALL_DATA=$(INSTALL_DATA)" \
122 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)"
125 "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
126 "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
127 "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
128 "OBJDUMP_FOR_TARGET=$(OBJDUMP_FOR_TARGET)"
130 # Lists of files for various purposes.
135 $(srcdir)/atof-generic.c \
136 $(srcdir)/bignum-copy.c \
139 $(srcdir)/flonum-konst.c \
140 $(srcdir)/flonum-copy.c \
141 $(srcdir)/flonum-mult.c \
144 $(srcdir)/hex-value.c \
145 $(srcdir)/input-file.c \
146 $(srcdir)/input-scrub.c \
147 $(srcdir)/messages.c \
148 $(srcdir)/output-file.c \
150 $(srcdir)/subsegs.c \
151 $(srcdir)/symbols.c \
153 $(srcdir)/listing.c \
156 # in an expedient order
162 SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES)
171 $(srcdir)/input-file.h \
172 $(srcdir)/listing.h \
176 $(srcdir)/struc-symbol.h \
177 $(srcdir)/subsegs.h \
178 $(srcdir)/symbols.h \
190 HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS)
219 #### host, target, and site specific Makefile frags come in here.
222 @(cd doc ; $(MAKE) $(FLAGS_TO_PASS) all)
225 @(cd doc ; $(MAKE) $(FLAGS_TO_PASS) $@)
228 @(cd doc ; $(MAKE) $(FLAGS_TO_PASS) install-info)
231 @(cd doc ; $(MAKE) $(FLAGS_TO_PASS) clean-info)
233 # Now figure out from those variables how to compile and link.
235 # This is the variable actually used when we compile.
236 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CROSS) $(CFLAGS) $(HDEFINES) $(TDEFINES) \
239 # How to link with both our special library facilities
240 # and the system's installed libraries.
242 LIBS = ../opcodes/libopcodes.a $(BFDLIB) $(LOCAL_LOADLIBES) \
243 ../libiberty/libiberty.a
245 # Specify the directories to be searched for header files.
246 # Both . and srcdir are used, in that order,
247 # so that tm.h and config.h will be found in the compilation
248 # subdirectory rather than in the source directory.
249 INCLUDES = -I. -I$(srcdir) -I../bfd -I$(srcdir)/config -I$(srcdir)/../include
250 SUBDIR_INCLUDES = -I.. -I$(srcdir) -I$(srcdir)/config
252 # Always use -I$(srcdir)/config when compiling.
254 $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
256 # This tells GNU make version 3 not to export all the variables
257 # defined in this file into the environment.
260 # Files to be copied away after each stage in building.
261 STAGESTUFF = *.o as.new
263 as.new: $(OBJS) $(LIBS)
264 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES)
267 @echo No installcheck target is available yet for the GNU assembler.
270 @(here=`pwd` ; export here ; \
271 cd testsuite ; $(MAKE) $(FLAGS_TO_PASS) $(CHECKFLAGS) check)
274 @echo You must configure gas. Look at the INSTALL file for details.
277 config.h: config-stamp ; @true
278 config-stamp: Makefile
279 -rm -f config.new config-stamp
280 echo '#define TARGET_CPU "$(target_cpu)"' > config.new
281 echo '#define TARGET_ALIAS "$(target_alias)"' >> config.new
282 echo '#define TARGET_CANONICAL "$(target_canonical)"' >> config.new
283 echo '#define GAS_VERSION "$(VERSION)"' >> config.new
284 $(srcdir)/../move-if-change config.new config.h
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 subsegs.h \
296 atof-generic.o : atof-generic.c as.h host.h targ-env.h obj-format.h \
297 targ-cpu.h struc-symbol.h \
298 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
299 bignum-copy.o : bignum-copy.c as.h host.h \
300 targ-env.h obj-format.h \
301 targ-cpu.h struc-symbol.h \
302 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
303 cond.o : cond.c as.h host.h targ-env.h obj-format.h \
304 targ-cpu.h struc-symbol.h \
305 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
307 debug.o : debug.c as.h host.h targ-env.h obj-format.h \
308 targ-cpu.h struc-symbol.h \
309 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
311 expr.o : expr.c as.h host.h targ-env.h obj-format.h \
312 targ-cpu.h struc-symbol.h \
313 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
315 flonum-konst.o : flonum-konst.c flonum.h bignum.h
316 flonum-copy.o : flonum-copy.c as.h host.h targ-env.h obj-format.h \
317 targ-cpu.h struc-symbol.h \
318 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
319 flonum-mult.o : flonum-mult.c flonum.h bignum.h
320 frags.o : frags.c as.h host.h targ-env.h obj-format.h \
321 targ-cpu.h struc-symbol.h \
322 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
324 hash.o : hash.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
327 hex-value.o : hex-value.c
328 input-file.o : input-file.c as.h host.h \
329 targ-env.h obj-format.h targ-cpu.h \
330 struc-symbol.h write.h flonum.h bignum.h expr.h \
331 frags.h hash.h read.h symbols.h tc.h obj.h input-file.h
332 input-scrub.o : input-scrub.c /usr/include/errno.h /usr/include/sys/errno.h \
333 as.h host.h targ-env.h obj-format.h \
334 targ-cpu.h struc-symbol.h \
335 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
337 listing.o : listing.c as.h host.h targ-env.h flonum.h bignum.h \
338 listing.h obj-format.h targ-cpu.h struc-symbol.h write.h expr.h \
339 frags.h hash.h read.h symbols.h tc.h obj.h input-file.h
340 messages.o : messages.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
343 output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \
344 targ-cpu.h struc-symbol.h \
345 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
347 read.o : read.c as.h host.h targ-env.h obj-format.h \
348 targ-cpu.h struc-symbol.h \
349 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
350 subsegs.o : subsegs.c as.h host.h targ-env.h obj-format.h \
351 targ-cpu.h struc-symbol.h \
352 write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
354 symbols.o : symbols.c 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 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 atof-targ.o : atof-targ.c as.h host.h targ-env.h obj-format.h \
364 targ-cpu.h struc-symbol.h \
365 write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
367 obj-format.o : obj-format.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 \
370 subsegs.h symbols.h tc.h obj.h
371 targ-cpu.o : targ-cpu.c config.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 \
374 symbols.h tc.h obj.h $(TARG_CPU_DEPENDENTS)
376 # Remake the info files.
378 doc: $(srcdir)/as.info
380 $(srcdir)/as.info: $(srcdir)/doc/as.texinfo
381 @(cd doc; $(MAKE) $(FLAGS_TO_PASS) as.info; mv as.info $srcdir)
384 @(cd doc ; $(MAKE) $(FLAGS_TO_PASS) clean)
385 @(cd testsuite ; $(MAKE) $(FLAGS_TO_PASS) clean)
386 -rm -f $(STAGESTUFF) core
388 # Like clean but also delete the links made to configure gas.
390 -rm -f config.status Makefile host.h targ-env.h targ-cpu.h \
391 targ-cpu.c obj-format.h obj-format.c atof-targ.c TAGS
393 # Entry points `install', `includes' and `uninstall'.
395 # Copy the files into directories where they will be run.
397 $(INSTALL_XFORM) as.new $(bindir)/as; \
398 $(INSTALL_XFORM1) $(srcdir)/doc/as.1 $(man1dir)/as.1;
399 -n=`t='$(program_transform_name)'; echo as | sed -e "" $$t`; \
400 if [ -d $(tooldir) ]; then \
401 if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \
402 rm -f $(tooldir)/bin/as; \
403 ln $(bindir)/$$n $(tooldir)/bin/as \
404 || $(INSTALL_PROGRAM) as.new $(tooldir)/bin/as; \
407 # Cancel installation by deleting the installed files.
409 -n=`t='$(program_transform_name)'; echo as | sed -e "" $$t`; \
410 rm -f $(bindir)/$$n; \
411 rm -f $(mandir)/$$n.1
413 # These exist for maintenance purposes.
416 etags $(REAL_HEADERS) $(REAL_SOURCES) $(srcdir)/config/*.[hc] $(srcdir)/README $(srcdir)/Makefile.in
418 bootstrap: as.new force
420 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
422 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
423 $(MAKE) comparison against=stage2
426 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
428 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
429 $(MAKE) comparison against=stage2
432 $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new
433 $(MAKE) comparison against=stage2
435 # Copy the object files from a particular stage into a subdirectory.
438 -mv $(STAGESTUFF) stage1
439 if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi
443 -mv $(STAGESTUFF) stage2
444 if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi
448 -mv $(STAGESTUFF) stage3
449 if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi
454 for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done
457 - (cd stage1 ; rm as ; mv -f * ..)
461 - (cd stage2 ; rm as ; mv -f * ..)
465 - (cd stage3 ; rm as ; mv -f * ..)
468 #In GNU Make, ignore whether `stage*' exists.
469 .PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
473 Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) \
474 $(srcdir)/configure.in
475 $(SHELL) ./config.status