Blame mpn/Makeasm.am

Packit 5c3484
## Automake asm file rules.
Packit 5c3484
Packit 5c3484
# Copyright 1996, 1998-2002 Free Software Foundation, Inc.
Packit 5c3484
#
Packit 5c3484
#  This file is part of the GNU MP Library.
Packit 5c3484
#
Packit 5c3484
#  The GNU MP Library is free software; you can redistribute it and/or modify
Packit 5c3484
#  it under the terms of either:
Packit 5c3484
#
Packit 5c3484
#    * the GNU Lesser General Public License as published by the Free
Packit 5c3484
#      Software Foundation; either version 3 of the License, or (at your
Packit 5c3484
#      option) any later version.
Packit 5c3484
#
Packit 5c3484
#  or
Packit 5c3484
#
Packit 5c3484
#    * the GNU General Public License as published by the Free Software
Packit 5c3484
#      Foundation; either version 2 of the License, or (at your option) any
Packit 5c3484
#      later version.
Packit 5c3484
#
Packit 5c3484
#  or both in parallel, as here.
Packit 5c3484
#
Packit 5c3484
#  The GNU MP Library is distributed in the hope that it will be useful, but
Packit 5c3484
#  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit 5c3484
#  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit 5c3484
#  for more details.
Packit 5c3484
#
Packit 5c3484
#  You should have received copies of the GNU General Public License and the
Packit 5c3484
#  GNU Lesser General Public License along with the GNU MP Library.  If not,
Packit 5c3484
#  see https://www.gnu.org/licenses/.
Packit 5c3484
Packit 5c3484
Packit 5c3484
# COMPILE minus CC.
Packit 5c3484
#
Packit 5c3484
COMPILE_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
Packit 5c3484
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASMFLAGS)
Packit 5c3484
Packit 5c3484
# Flags used for preprocessing (in ansi2knr rules).
Packit 5c3484
#
Packit 5c3484
PREPROCESS_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
Packit 5c3484
	$(CPPFLAGS)
Packit 5c3484
Packit 5c3484
Packit 5c3484
# Recent versions of automake (1.5 and up for instance) append automake
Packit 5c3484
# generated suffixes to this $(SUFFIXES) list.  This is essential for us,
Packit 5c3484
# since .c must come after .s, .S and .asm.  If .c is before .s, for
Packit 5c3484
# instance, then in the mpn directory "make" will see add_n.c mentioned in
Packit 5c3484
# an explicit rule (the ansi2knr stuff) and decide it must have add_n.c,
Packit 5c3484
# even if add_n.c doesn't exist but add_n.s does.  See GNU make
Packit 5c3484
# documentation "(make)Implicit Rule Search", part 5c.
Packit 5c3484
#
Packit 5c3484
# On IRIX 6 native make this doesn't work properly though.  Somehow .c
Packit 5c3484
# remains ahead of .s, perhaps because .c.s is a builtin rule.  .asm works
Packit 5c3484
# fine though, and mpn/mips3 uses this.
Packit 5c3484
#
Packit 5c3484
SUFFIXES = .s .S .asm
Packit 5c3484
Packit 5c3484
Packit 5c3484
# .s assembler, no preprocessing.
Packit 5c3484
#
Packit 5c3484
.s.o:
Packit 5c3484
	$(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
Packit 5c3484
.s.obj:
Packit 5c3484
	$(CCAS) $(COMPILE_FLAGS) `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
Packit 5c3484
.s.lo:
Packit 5c3484
	$(LIBTOOL) --mode=compile --tag=CC $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
Packit 5c3484
Packit 5c3484
Packit 5c3484
# can be overridden during development, eg. "make RM_TMP=: mul_1.lo"
rpm-build ec82a7
RM_TMP = true
Packit 5c3484
Packit 5c3484
Packit 5c3484
# .S assembler, preprocessed with cpp.
Packit 5c3484
#
Packit 5c3484
# It's necessary to run $(CPP) separately, since it seems not all compilers
Packit 5c3484
# recognise .S files, in particular "cc" on HP-UX 10 and 11 doesn't (and
Packit 5c3484
# will silently do nothing if given a .S).
Packit 5c3484
#
Packit 5c3484
# For .lo we need a helper script, as described below for .asm.lo.
Packit 5c3484
#
Packit 5c3484
.S.o:
Packit 5c3484
	$(CPP) $(PREPROCESS_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$< | grep -v '^#' >tmp-$*.s
Packit 5c3484
	$(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
Packit 5c3484
	$(RM_TMP) tmp-$*.s
Packit 5c3484
.S.obj:
Packit 5c3484
	$(CPP) $(PREPROCESS_FLAGS) `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` | grep -v '^#' >tmp-$*.s
Packit 5c3484
	$(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
Packit 5c3484
	$(RM_TMP) tmp-$*.s
Packit 5c3484
.S.lo:
Packit 5c3484
	$(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/cpp-ccas --cpp="$(CPP) $(PREPROCESS_FLAGS)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
Packit 5c3484
Packit 5c3484
Packit 5c3484
# .asm assembler, preprocessed with m4.
Packit 5c3484
#
Packit 5c3484
# .o and .obj are non-PIC and just need m4 followed by a compile.
Packit 5c3484
#
Packit 5c3484
# .lo is a bit tricky.  Libtool (as of version 1.5) has foo.lo as a little
Packit 5c3484
# text file, and .libs/foo.o and foo.o as the PIC and non-PIC objects,
Packit 5c3484
# respectively.  It'd be asking for lots of trouble to try to create foo.lo
Packit 5c3484
# ourselves, so instead arrange to invoke libtool like a --mode=compile, but
Packit 5c3484
# with a special m4-ccas script which first m4 preprocesses, then compiles.
Packit 5c3484
# --tag=CC is necessary since foo.asm is otherwise unknown to libtool.
Packit 5c3484
#
Packit 5c3484
# Libtool adds -DPIC when building a shared object and the .asm files look
Packit 5c3484
# for that.  But it should be noted that the other PIC flags are on occasion
Packit 5c3484
# important too, in particular FreeBSD 2.2.8 gas 1.92.3 requires -k before
Packit 5c3484
# it accepts PIC constructs like @GOT, and gcc adds that flag only under
Packit 5c3484
# -fPIC.  (Later versions of gas are happy to accept PIC stuff any time.)
Packit 5c3484
#
Packit 5c3484
.asm.o:
Packit 5c3484
	$(M4) -DOPERATION_$* `test -f '$<' || echo '$(srcdir)/'`$< >tmp-$*.s
Packit 5c3484
	$(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
Packit 5c3484
	$(RM_TMP) tmp-$*.s
Packit 5c3484
.asm.obj:
Packit 5c3484
	$(M4) -DOPERATION_$* `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` >tmp-$*.s
Packit 5c3484
	$(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
Packit 5c3484
	$(RM_TMP) tmp-$*.s
Packit 5c3484
.asm.lo:
Packit 5c3484
	$(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/m4-ccas --m4="$(M4)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<