1## Automake asm file rules. 2 3# Copyright 1996, 1998-2002 Free Software Foundation, Inc. 4# 5# This file is part of the GNU MP Library. 6# 7# The GNU MP Library is free software; you can redistribute it and/or modify 8# it under the terms of either: 9# 10# * the GNU Lesser General Public License as published by the Free 11# Software Foundation; either version 3 of the License, or (at your 12# option) any later version. 13# 14# or 15# 16# * the GNU General Public License as published by the Free Software 17# Foundation; either version 2 of the License, or (at your option) any 18# later version. 19# 20# or both in parallel, as here. 21# 22# The GNU MP Library is distributed in the hope that it will be useful, but 23# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 24# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25# for more details. 26# 27# You should have received copies of the GNU General Public License and the 28# GNU Lesser General Public License along with the GNU MP Library. If not, 29# see https://www.gnu.org/licenses/. 30 31 32# COMPILE minus CC. 33# 34COMPILE_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 35 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASMFLAGS) 36 37# Flags used for preprocessing (in ansi2knr rules). 38# 39PREPROCESS_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 40 $(CPPFLAGS) 41 42 43# Recent versions of automake (1.5 and up for instance) append automake 44# generated suffixes to this $(SUFFIXES) list. This is essential for us, 45# since .c must come after .s, .S and .asm. If .c is before .s, for 46# instance, then in the mpn directory "make" will see add_n.c mentioned in 47# an explicit rule (the ansi2knr stuff) and decide it must have add_n.c, 48# even if add_n.c doesn't exist but add_n.s does. See GNU make 49# documentation "(make)Implicit Rule Search", part 5c. 50# 51# On IRIX 6 native make this doesn't work properly though. Somehow .c 52# remains ahead of .s, perhaps because .c.s is a builtin rule. .asm works 53# fine though, and mpn/mips3 uses this. 54# 55SUFFIXES = .s .S .asm 56 57 58# .s assembler, no preprocessing. 59# 60.s.o: 61 $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< 62.s.obj: 63 $(CCAS) $(COMPILE_FLAGS) `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` 64.s.lo: 65 $(LIBTOOL) --mode=compile --tag=CC $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< 66 67 68# can be overridden during development, eg. "make RM_TMP=: mul_1.lo" 69RM_TMP = rm -f 70 71 72# .S assembler, preprocessed with cpp. 73# 74# It's necessary to run $(CPP) separately, since it seems not all compilers 75# recognise .S files, in particular "cc" on HP-UX 10 and 11 doesn't (and 76# will silently do nothing if given a .S). 77# 78# For .lo we need a helper script, as described below for .asm.lo. 79# 80.S.o: 81 $(CPP) $(PREPROCESS_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< | grep -v '^#' >tmp-$*.s 82 $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@ 83 $(RM_TMP) tmp-$*.s 84.S.obj: 85 $(CPP) $(PREPROCESS_FLAGS) `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` | grep -v '^#' >tmp-$*.s 86 $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@ 87 $(RM_TMP) tmp-$*.s 88.S.lo: 89 $(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/cpp-ccas --cpp="$(CPP) $(PREPROCESS_FLAGS)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< 90 91 92# .asm assembler, preprocessed with m4. 93# 94# .o and .obj are non-PIC and just need m4 followed by a compile. 95# 96# .lo is a bit tricky. Libtool (as of version 1.5) has foo.lo as a little 97# text file, and .libs/foo.o and foo.o as the PIC and non-PIC objects, 98# respectively. It'd be asking for lots of trouble to try to create foo.lo 99# ourselves, so instead arrange to invoke libtool like a --mode=compile, but 100# with a special m4-ccas script which first m4 preprocesses, then compiles. 101# --tag=CC is necessary since foo.asm is otherwise unknown to libtool. 102# 103# Libtool adds -DPIC when building a shared object and the .asm files look 104# for that. But it should be noted that the other PIC flags are on occasion 105# important too, in particular FreeBSD 2.2.8 gas 1.92.3 requires -k before 106# it accepts PIC constructs like @GOT, and gcc adds that flag only under 107# -fPIC. (Later versions of gas are happy to accept PIC stuff any time.) 108# 109.asm.o: 110 $(M4) -DOPERATION_$* `test -f '$<' || echo '$(srcdir)/'`$< >tmp-$*.s 111 $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@ 112 $(RM_TMP) tmp-$*.s 113.asm.obj: 114 $(M4) -DOPERATION_$* `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >tmp-$*.s 115 $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@ 116 $(RM_TMP) tmp-$*.s 117.asm.lo: 118 $(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/m4-ccas --m4="$(M4)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< 119