| 1 | # Makefile for GNU Assembler |
| 2 | # Copyright (C) 1987-1992 Free Software Foundation, Inc. |
| 3 | |
| 4 | #This file is part of GNU GAS. |
| 5 | |
| 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) |
| 9 | #any later version. |
| 10 | |
| 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. |
| 15 | |
| 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. |
| 19 | |
| 20 | # The targets for external use include: |
| 21 | # all, doc, proto, install, uninstall, includes, TAGS, |
| 22 | # clean, cleanconfig, realclean, stage1, stage2, stage3, stage4. |
| 23 | |
| 24 | # Variables that exist for you to override. |
| 25 | # See below for how to change them for certain systems. |
| 26 | |
| 27 | srcdir = . |
| 28 | |
| 29 | prefix = /usr/local |
| 30 | |
| 31 | program_transform_name = |
| 32 | exec_prefix = $(prefix) |
| 33 | bindir = $(exec_prefix)/bin |
| 34 | libdir = $(exec_prefix)/lib |
| 35 | tooldir = $(libdir)/$(target_alias) |
| 36 | |
| 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 |
| 51 | |
| 52 | SHELL = /bin/sh |
| 53 | |
| 54 | INSTALL = install -c |
| 55 | INSTALL_PROGRAM = $(INSTALL) |
| 56 | INSTALL_DATA = $(INSTALL) |
| 57 | |
| 58 | AR = ar |
| 59 | AR_FLAGS = qv |
| 60 | BISON = bison |
| 61 | MAKEINFO = makeinfo |
| 62 | RANLIB = ranlib |
| 63 | CFLAGS = -g |
| 64 | |
| 65 | FLAGS_TO_PASS = \ |
| 66 | "prefix=$(prefix)" \ |
| 67 | "exec_prefix=$(exec_prefix)" \ |
| 68 | "tooldir=$(tooldir)" \ |
| 69 | "AR=$(AR)" \ |
| 70 | "AR_FLAGS=$(AR_FLAGS)" \ |
| 71 | "CC=$(CC)" \ |
| 72 | "CFLAGS=$(CFLAGS)" \ |
| 73 | "RANLIB=$(RANLIB)" \ |
| 74 | "LOADLIBES=$(LOADLIBES)" \ |
| 75 | "LDFLAGS=$(LDFLAGS)" \ |
| 76 | "BISON=$(BISON)" \ |
| 77 | "LEX=$(LEX)" \ |
| 78 | "MAKEINFO=$(MAKEINFO)" \ |
| 79 | "INSTALL=$(INSTALL)" \ |
| 80 | "INSTALL_DATA=$(INSTALL_DATA)" \ |
| 81 | "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" |
| 82 | |
| 83 | # Lists of files for various purposes. |
| 84 | |
| 85 | REAL_SOURCES = \ |
| 86 | $(srcdir)/app.c \ |
| 87 | $(srcdir)/as.c \ |
| 88 | $(srcdir)/atof-generic.c \ |
| 89 | $(srcdir)/bignum-copy.c \ |
| 90 | $(srcdir)/cond.c \ |
| 91 | $(srcdir)/expr.c \ |
| 92 | $(srcdir)/flonum-konst.c \ |
| 93 | $(srcdir)/flonum-copy.c \ |
| 94 | $(srcdir)/flonum-mult.c \ |
| 95 | $(srcdir)/frags.c \ |
| 96 | $(srcdir)/hash.c \ |
| 97 | $(srcdir)/hex-value.c \ |
| 98 | $(srcdir)/input-file.c \ |
| 99 | $(srcdir)/input-scrub.c \ |
| 100 | $(srcdir)/messages.c \ |
| 101 | $(srcdir)/output-file.c \ |
| 102 | $(srcdir)/read.c \ |
| 103 | $(srcdir)/subsegs.c \ |
| 104 | $(srcdir)/symbols.c \ |
| 105 | $(srcdir)/version.c \ |
| 106 | $(srcdir)/write.c \ |
| 107 | $(srcdir)/listing.c \ |
| 108 | $(srcdir)/xmalloc.c |
| 109 | |
| 110 | # in an expedient order |
| 111 | LINKED_SOURCES = \ |
| 112 | targ-cpu.c \ |
| 113 | obj-format.c \ |
| 114 | atof-targ.c |
| 115 | |
| 116 | SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES) |
| 117 | |
| 118 | REAL_HEADERS = \ |
| 119 | $(srcdir)/as.h \ |
| 120 | $(srcdir)/bignum.h \ |
| 121 | $(srcdir)/expr.h \ |
| 122 | $(srcdir)/flonum.h \ |
| 123 | $(srcdir)/frags.h \ |
| 124 | $(srcdir)/hash.h \ |
| 125 | $(srcdir)/input-file.h \ |
| 126 | $(srcdir)/listing.h \ |
| 127 | $(srcdir)/tc.h \ |
| 128 | $(srcdir)/obj.h \ |
| 129 | $(srcdir)/read.h \ |
| 130 | $(srcdir)/struc-symbol.h \ |
| 131 | $(srcdir)/subsegs.h \ |
| 132 | $(srcdir)/symbols.h \ |
| 133 | $(srcdir)/write.h |
| 134 | |
| 135 | LINKED_HEADERS = \ |
| 136 | a.out.gnu.h \ |
| 137 | a.out.h \ |
| 138 | host.h \ |
| 139 | targ-env.h \ |
| 140 | targ-cpu.h \ |
| 141 | obj-format.h \ |
| 142 | atof-targ.h |
| 143 | |
| 144 | HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS) |
| 145 | |
| 146 | OBJS = \ |
| 147 | targ-cpu.o \ |
| 148 | obj-format.o \ |
| 149 | atof-targ.o \ |
| 150 | app.o \ |
| 151 | as.o \ |
| 152 | atof-generic.o \ |
| 153 | bignum-copy.o \ |
| 154 | cond.o \ |
| 155 | expr.o \ |
| 156 | flonum-konst.o \ |
| 157 | flonum-copy.o \ |
| 158 | flonum-mult.o \ |
| 159 | frags.o \ |
| 160 | hash.o \ |
| 161 | hex-value.o \ |
| 162 | input-file.o \ |
| 163 | input-scrub.o \ |
| 164 | messages.o \ |
| 165 | output-file.o \ |
| 166 | read.o \ |
| 167 | subsegs.o \ |
| 168 | symbols.o \ |
| 169 | version.o \ |
| 170 | write.o \ |
| 171 | listing.o \ |
| 172 | xmalloc.o |
| 173 | |
| 174 | #### host, target, and site specific Makefile frags come in here. |
| 175 | |
| 176 | all: as.new |
| 177 | @(cd doc ; $(MAKE) $(FLAGS_TO_PASS) all) |
| 178 | |
| 179 | info: |
| 180 | @(cd doc ; $(MAKE) $(FLAGS_TO_PASS) info) |
| 181 | |
| 182 | install-info: |
| 183 | @(cd doc ; $(MAKE) $(FLAGS_TO_PASS) install-info) |
| 184 | |
| 185 | clean-info: |
| 186 | @(cd doc ; $(MAKE) $(FLAGS_TO_PASS) clean-info) |
| 187 | |
| 188 | # Now figure out from those variables how to compile and link. |
| 189 | |
| 190 | # This is the variable actually used when we compile. |
| 191 | ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CROSS) $(CFLAGS) $(HDEFINES) $(TDEFINES) -DTARGET_CPU=\"$(target_cpu)\" |
| 192 | |
| 193 | # How to link with both our special library facilities |
| 194 | # and the system's installed libraries. |
| 195 | |
| 196 | LIBS = ../opcodes/libopcodes.a $(LOCAL_LOADLIBES) $(CLIB) ../libiberty/libiberty.a |
| 197 | |
| 198 | # Specify the directories to be searched for header files. |
| 199 | # Both . and srcdir are used, in that order, |
| 200 | # so that tm.h and config.h will be found in the compilation |
| 201 | # subdirectory rather than in the source directory. |
| 202 | INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config -I$(srcdir)/../include |
| 203 | SUBDIR_INCLUDES = -I.. -I$(srcdir) -I$(srcdir)/config |
| 204 | |
| 205 | # Always use -I$(srcdir)/config when compiling. |
| 206 | .c.o: |
| 207 | $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $< |
| 208 | |
| 209 | # This tells GNU make version 3 not to export all the variables |
| 210 | # defined in this file into the environment. |
| 211 | .NOEXPORT: |
| 212 | |
| 213 | # Files to be copied away after each stage in building. |
| 214 | STAGESTUFF = *.o as.new |
| 215 | |
| 216 | as.new: $(OBJS) $(LIBS) |
| 217 | [ ! -f as.new ] || mv as.new as.old |
| 218 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o as.new $(OBJS) $(LIBS) $(LOADLIBES) |
| 219 | |
| 220 | check: |
| 221 | |
| 222 | config.status: |
| 223 | @echo You must configure gas. Look at the INSTALL file for details. |
| 224 | @false |
| 225 | |
| 226 | # Compiling object files from source files. |
| 227 | |
| 228 | app.o : app.c as.h host.h targ-env.h obj-format.h \ |
| 229 | targ-cpu.h struc-symbol.h \ |
| 230 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h |
| 231 | as.o : as.c as.h host.h targ-env.h obj-format.h \ |
| 232 | targ-cpu.h struc-symbol.h \ |
| 233 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h subsegs.h \ |
| 234 | tc.h obj.h |
| 235 | atof-generic.o : atof-generic.c as.h host.h targ-env.h obj-format.h \ |
| 236 | targ-cpu.h struc-symbol.h \ |
| 237 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h |
| 238 | bignum-copy.o : bignum-copy.c as.h host.h \ |
| 239 | targ-env.h obj-format.h \ |
| 240 | targ-cpu.h struc-symbol.h \ |
| 241 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h |
| 242 | cond.o : cond.c as.h host.h targ-env.h obj-format.h \ |
| 243 | targ-cpu.h struc-symbol.h \ |
| 244 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h |
| 245 | |
| 246 | debug.o : debug.c as.h host.h targ-env.h obj-format.h \ |
| 247 | targ-cpu.h struc-symbol.h \ |
| 248 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ |
| 249 | subsegs.h |
| 250 | expr.o : expr.c as.h host.h targ-env.h obj-format.h \ |
| 251 | targ-cpu.h struc-symbol.h \ |
| 252 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h |
| 253 | |
| 254 | flonum-konst.o : flonum-konst.c flonum.h bignum.h |
| 255 | flonum-copy.o : flonum-copy.c as.h host.h targ-env.h obj-format.h \ |
| 256 | targ-cpu.h struc-symbol.h \ |
| 257 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h |
| 258 | flonum-mult.o : flonum-mult.c flonum.h bignum.h |
| 259 | frags.o : frags.c as.h host.h targ-env.h obj-format.h \ |
| 260 | targ-cpu.h struc-symbol.h \ |
| 261 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ |
| 262 | subsegs.h |
| 263 | hash.o : hash.c as.h host.h targ-env.h obj-format.h \ |
| 264 | targ-cpu.h struc-symbol.h \ |
| 265 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h |
| 266 | hex-value.o : hex-value.c |
| 267 | input-file.o : input-file.c as.h host.h \ |
| 268 | targ-env.h obj-format.h targ-cpu.h \ |
| 269 | struc-symbol.h write.h flonum.h bignum.h expr.h \ |
| 270 | frags.h hash.h read.h symbols.h tc.h obj.h input-file.h |
| 271 | input-scrub.o : input-scrub.c /usr/include/errno.h /usr/include/sys/errno.h \ |
| 272 | as.h host.h targ-env.h obj-format.h \ |
| 273 | targ-cpu.h struc-symbol.h \ |
| 274 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ |
| 275 | input-file.h |
| 276 | listing.o : listing.c as.h host.h targ-env.h flonum.h bignum.h \ |
| 277 | listing.h obj-format.h targ-cpu.h struc-symbol.h write.h expr.h \ |
| 278 | frags.h hash.h read.h symbols.h tc.h obj.h input-file.h |
| 279 | messages.o : messages.c as.h host.h targ-env.h obj-format.h \ |
| 280 | targ-cpu.h struc-symbol.h \ |
| 281 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h |
| 282 | output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \ |
| 283 | targ-cpu.h struc-symbol.h \ |
| 284 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ |
| 285 | output-file.h |
| 286 | read.o : read.c as.h host.h targ-env.h obj-format.h \ |
| 287 | targ-cpu.h struc-symbol.h \ |
| 288 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h |
| 289 | subsegs.o : subsegs.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 | subsegs.h |
| 293 | symbols.o : symbols.c as.h host.h targ-env.h obj-format.h \ |
| 294 | targ-cpu.h struc-symbol.h \ |
| 295 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ |
| 296 | subsegs.h |
| 297 | version.o : version.c |
| 298 | write.o : write.c as.h host.h targ-env.h obj-format.h \ |
| 299 | targ-cpu.h struc-symbol.h \ |
| 300 | write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \ |
| 301 | subsegs.h output-file.h |
| 302 | xmalloc.o : xmalloc.c |
| 303 | atof-targ.o : atof-targ.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 \ |
| 306 | symbols.h tc.h obj.h |
| 307 | obj-format.o : obj-format.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 \ |
| 310 | subsegs.h symbols.h tc.h obj.h |
| 311 | targ-cpu.o : targ-cpu.c 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 \ |
| 314 | symbols.h tc.h obj.h $(TARG_CPU_DEPENDENTS) |
| 315 | |
| 316 | # Remake the info files. |
| 317 | |
| 318 | doc: $(srcdir)/as.info |
| 319 | |
| 320 | $(srcdir)/as.info: $(srcdir)/doc/as.texinfo |
| 321 | @(cd doc; make $(FLAGS_TO_PASS) as.info; mv as.info $srcdir) |
| 322 | |
| 323 | clean: |
| 324 | @(cd doc ; $(MAKE) $(FLAGS_TO_PASS) clean) |
| 325 | -rm -f $(STAGESTUFF) core |
| 326 | |
| 327 | # Like clean but also delete the links made to configure gas. |
| 328 | distclean: clean |
| 329 | -rm -f config.status Makefile host.h targ-env.h targ-cpu.h \ |
| 330 | targ-cpu.c obj-format.h obj-format.c atof-targ.c \ |
| 331 | gas.aux gas.cps gas.fns gas.info gas.kys gas.pgs |
| 332 | gas.tps gas.vrs TAGS gas.info* gas.?? gas.??s gas.log \ |
| 333 | gas.toc gas.*aux *.dvi |
| 334 | |
| 335 | # Entry points `install', `includes' and `uninstall'. |
| 336 | |
| 337 | # Copy the files into directories where they will be run. |
| 338 | install: |
| 339 | -parent=`echo $(bindir)|sed -e 's@/[^/]*$$@@'`; \ |
| 340 | if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi |
| 341 | -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; fi |
| 342 | -parent=`echo $(man1dir)|sed -e 's@/[^/]*$$@@'`; \ |
| 343 | if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi |
| 344 | -if [ -d $(man1dir) ] ; then true ; else mkdir $(man1dir) ; fi |
| 345 | -n=`t='$(program_transform_name)'; echo as | sed -e "" $$t`; \ |
| 346 | rm -f $(bindir)/$$n; \ |
| 347 | $(INSTALL_PROGRAM) as.new $(bindir)/$$n; \ |
| 348 | $(INSTALL_DATA) $(srcdir)/doc/as.1 $(man1dir)/$$n.1; \ |
| 349 | if [ -d $(tooldir) ]; then \ |
| 350 | if [ -d $(tooldir)/bin ] ; then true ; else mkdir $(tooldir)/bin ; fi; \ |
| 351 | rm -f $(tooldir)/bin/as; \ |
| 352 | ln $(bindir)/$$n $(tooldir)/bin/as \ |
| 353 | || $(INSTALL_PROGRAM) as.new $(tooldir)/bin/as; \ |
| 354 | else true; fi |
| 355 | |
| 356 | # Cancel installation by deleting the installed files. |
| 357 | uninstall: |
| 358 | -n=`t='$(program_transform_name)'; echo as | sed -e "" $$t`; \ |
| 359 | rm -f $(bindir)/$$n; \ |
| 360 | rm -f $(mandir)/$$n.1 |
| 361 | |
| 362 | # These exist for maintenance purposes. |
| 363 | |
| 364 | tags TAGS: force |
| 365 | etags $(REAL_HEADERS) $(REAL_SOURCES) $(srcdir)/config/*.[hc] $(srcdir)/README $(srcdir)/Makefile.in |
| 366 | |
| 367 | bootstrap: as.new force |
| 368 | $(MAKE) stage1 |
| 369 | $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new |
| 370 | $(MAKE) stage2 |
| 371 | $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new |
| 372 | $(MAKE) comparison against=stage2 |
| 373 | |
| 374 | bootstrap2: force |
| 375 | $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new |
| 376 | $(MAKE) stage2 |
| 377 | $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new |
| 378 | $(MAKE) comparison against=stage2 |
| 379 | |
| 380 | bootstrap3: force |
| 381 | $(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= as.new |
| 382 | $(MAKE) comparison against=stage2 |
| 383 | |
| 384 | # Copy the object files from a particular stage into a subdirectory. |
| 385 | stage1: force |
| 386 | -mkdir stage1 |
| 387 | -mv $(STAGESTUFF) stage1 |
| 388 | if [ -f stage1/as.new -a ! -f stage1/as ] ; then (cd stage1 ; ln -s as.new as) ; fi |
| 389 | |
| 390 | stage2: force |
| 391 | -mkdir stage2 |
| 392 | -mv $(STAGESTUFF) stage2 |
| 393 | if [ -f stage2/as.new -a ! -f stage2/as ] ; then (cd stage2 ; ln -s as.new as) ; fi |
| 394 | |
| 395 | stage3: force |
| 396 | -mkdir stage3 |
| 397 | -mv $(STAGESTUFF) stage3 |
| 398 | if [ -f stage3/as.new -a ! -f stage3/as ] ; then (cd stage3 ; ln -s as.new as) ; fi |
| 399 | |
| 400 | against=stage2 |
| 401 | |
| 402 | comparison: force |
| 403 | for i in $(STAGESTUFF) ; do cmp $$i $(against)/$$i ; done |
| 404 | |
| 405 | de-stage1: force |
| 406 | - (cd stage1 ; rm as ; mv -f * ..) |
| 407 | - rmdir stage1 |
| 408 | |
| 409 | de-stage2: force |
| 410 | - (cd stage2 ; rm as ; mv -f * ..) |
| 411 | - rmdir stage2 |
| 412 | |
| 413 | de-stage3: force |
| 414 | - (cd stage3 ; rm as ; mv -f * ..) |
| 415 | - rmdir stage3 |
| 416 | |
| 417 | #In GNU Make, ignore whether `stage*' exists. |
| 418 | .PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap |
| 419 | |
| 420 | force: |
| 421 | |
| 422 | Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) |
| 423 | $(SHELL) ./config.status |
| 424 | |