1 ## Automake asm file rules.
3 # Copyright 1996, 1998-2002 Free Software Foundation, Inc.
5 # This file is part of the GNU MP Library.
7 # The GNU MP Library is free software; you can redistribute it and/or modify
8 # it under the terms of either:
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.
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
20 # or both in parallel, as here.
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
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/.
34 COMPILE_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
35 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASMFLAGS)
37 # Flags used for preprocessing (in ansi2knr rules).
39 PREPROCESS_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
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.
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.
58 # .s assembler, no preprocessing.
61 $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
63 $(CCAS) $(COMPILE_FLAGS) `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
65 $(LIBTOOL) --mode=compile --tag=CC $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
68 # can be overridden during development, eg. "make RM_TMP=: mul_1.lo"
72 # .S assembler, preprocessed with cpp.
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).
78 # For .lo we need a helper script, as described below for .asm.lo.
81 $(CPP) $(PREPROCESS_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< | grep -v '^#' >tmp-$*.s
82 $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
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 $@
89 $(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/cpp-ccas --cpp="$(CPP) $(PREPROCESS_FLAGS)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
92 # .asm assembler, preprocessed with m4.
94 # .o and .obj are non-PIC and just need m4 followed by a compile.
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.
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.)
110 $(M4) -DOPERATION_$* `test -f '$<' || echo '$(srcdir)/'`$< >tmp-$*.s
111 $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
114 $(M4) -DOPERATION_$* `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >tmp-$*.s
115 $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
118 $(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/m4-ccas --m4="$(M4)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<