# Makefile for vacall

#### Start of system configuration section. ####

HOST = @host@
CPU = @HOST_CPU_C_ABI@
OS = @host_os@

# Directories used by "make":
srcdir = @srcdir@

# Directories used by "make install":
prefix = @prefix@
local_prefix = /usr/local
exec_prefix = @exec_prefix@
libdir = @libdir@
includedir = @includedir@
mandir = @mandir@
datadir = @datadir@
datarootdir = @datarootdir@
htmldir = $(datadir)/html

# Programs used by "make":
CC = @CC@
CFLAGS = @CFLAGS@
CPP = @CPP@
INCLUDES = -I. -I$(srcdir)
ASPFLAGS = `if test @AS_UNDERSCORE@ = true; then echo '-DASM_UNDERSCORE'; fi`
LIBTOOL = @LIBTOOL@
LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
LIBTOOL_LINK = $(LIBTOOL) --mode=link
LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
AR = ar
AR_FLAGS = rc
RANLIB = @RANLIB@
MV = mv
LN = @LN@
RM = rm -f
@SET_MAKE@

# Programs used by "make install":
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

#### End of system configuration section. ####

SHELL = /bin/sh

# Needed by $(LIBTOOL).
top_builddir = .

OBJECTS = vacall.lo misc.lo structcpy.lo

all : $(OBJECTS) libvacall.la vacall_r.h

vacall.lo : vacall-$(CPU).lo
	$(RM) vacall.lo vacall.o
	$(LN) vacall-$(CPU).lo vacall.lo
	if test -f vacall-$(CPU).o; then $(LN) vacall-$(CPU).o vacall.o; fi

vacall-i386.lo : vacall-i386.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-i386.s

vacall-i386.s : $(srcdir)/vacall-i386-macro.S
	$(CPP) $(ASPFLAGS) $(srcdir)/vacall-i386-macro.S | grep -v '^ *#line' | grep -v '^#ident' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,% ,%,g' -e 's,\. ,.,g' > vacall-i386.s

vacall-sparc.lo : vacall-sparc.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-sparc.s

vacall-sparc.s : $(srcdir)/vacall-sparc.S
	$(CPP) $(ASPFLAGS) $(srcdir)/vacall-sparc.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' -e 's,\$$,#,g' > vacall-sparc.s

vacall-sparc64.lo : vacall-sparc64.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-sparc64.s

vacall-sparc64.s : $(srcdir)/vacall-sparc64.S
	$(CPP) $(ASPFLAGS) $(srcdir)/vacall-sparc64.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' -e 's,\$$,#,g' > vacall-sparc64.s

vacall-m68k.lo : vacall-m68k.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-m68k.s

vacall-m68k.s : $(srcdir)/vacall-m68k.mit.S $(srcdir)/vacall-m68k.mot.s $(srcdir)/vacall-m68k-netbsd.S
	case "$(OS)" in \
	  netbsd*) src=$(srcdir)/vacall-m68k-netbsd.S;; \
	  *) src=$(srcdir)/vacall-m68k.mit.S;; \
	esac; \
	$(CPP) $(ASPFLAGS) $$src | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' | if test @AS_UNDERSCORE@ = true; then sed -e 's/\$$//g'; else sed -e 's/\$$/%/g'; fi > vacall-m68k.s

vacall-mips.lo : vacall-mips.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-mips.s

vacall-mips.s : $(srcdir)/vacall-mips.S
	$(CPP) $(ASPFLAGS) $(srcdir)/vacall-mips.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-mips.s

vacall-mipsn32.lo : vacall-mipsn32.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-mipsn32.s

vacall-mipsn32.s : $(srcdir)/vacall-mipsn32.S
	$(CPP) $(ASPFLAGS) $(srcdir)/vacall-mipsn32.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-mipsn32.s

vacall-mips64.lo : vacall-mips64.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-mips64.s

vacall-mips64.s : $(srcdir)/vacall-mips64.S
	$(CPP) $(ASPFLAGS) $(srcdir)/vacall-mips64.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-mips64.s

vacall-alpha.lo : $(srcdir)/vacall-alpha.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-alpha.s

vacall-hppa.lo : $(srcdir)/vacall-hppa.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-hppa.s

vacall-s390.lo : $(srcdir)/vacall-s390.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-s390.s

vacall-arm.lo : vacall-arm.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-arm.s

vacall-arm.s : $(srcdir)/vacall-arm.S
	$(CPP) $(ASPFLAGS) $(srcdir)/vacall-arm.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$$,#,g' > vacall-arm.s

vacall-armel.lo : $(srcdir)/vacall-armel.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-armel.s

vacall-powerpc.lo : $(srcdir)/vacall-powerpc-aix.old.s $(srcdir)/vacall-powerpc-aix.new.s $(srcdir)/vacall-powerpc-sysv4.s $(srcdir)/vacall-powerpc-linux.s $(srcdir)/vacall-powerpc-macos.s $(srcdir)/vacall-powerpc-netbsd.s
	case "$(OS)" in \
	  aix3*) syntax=aix.old;; \
	  aix*) syntax=aix.new;; \
	  linux*) syntax=linux;; \
	  macos* | darwin*) syntax=macos;; \
	  netbsd*) syntax=netbsd;; \
	  *) syntax=sysv4;; \
	esac; \
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-powerpc-$${syntax}.s ; \
	cp vacall-powerpc-$${syntax}.lo vacall-powerpc.lo ; rm -f vacall-powerpc-$${syntax}.lo ; \
	if test -f vacall-powerpc-$${syntax}.o; then cp vacall-powerpc-$${syntax}.o vacall-powerpc.o; fi
# Note that vacall-powerpc-${syntax}.o is kept in place, because in some cases
# vacall-powerpc-${syntax}.lo contains a symbolic reference to it and therefore
# libtool may want to access it.

vacall-powerpc64.lo : $(srcdir)/vacall-powerpc64.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-powerpc64.s

vacall-m88k.lo : $(srcdir)/vacall-m88k.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-m88k.s

vacall-convex.lo : $(srcdir)/vacall-convex.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-convex.s

vacall-ia64.lo : $(srcdir)/vacall-ia64.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-ia64.s

vacall-x86_64.lo : $(srcdir)/vacall-x86_64.s
	$(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c $(srcdir)/vacall-x86_64.s

misc.lo : $(srcdir)/misc.c vacall_r.h config.h
	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/misc.c

structcpy.lo : $(srcdir)/structcpy.c
	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) -c $(srcdir)/structcpy.c

libvacall.la : $(OBJECTS)
	$(LIBTOOL_LINK) $(CC) -static -o libvacall.la -rpath $(libdir) $(OBJECTS)

# Installs the library and include files only. Typically called with only
# $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here.
install-lib : all force
	mkdir -p $(includedir)
	$(INSTALL_DATA) vacall_r.h $(includedir)/vacall_r.h

install : all force
	mkdir -p $(DESTDIR)$(prefix)
#	mkdir -p $(DESTDIR)$(exec_prefix)
#	mkdir -p $(DESTDIR)$(libdir)
#	$(LIBTOOL_INSTALL) $(INSTALL_DATA) libvacall.la $(DESTDIR)$(libdir)/libvacall.la
	mkdir -p $(DESTDIR)$(includedir)
	$(INSTALL_DATA) vacall_r.h $(DESTDIR)$(includedir)/vacall_r.h
#	mkdir -p $(DESTDIR)$(mandir)
#	mkdir -p $(DESTDIR)$(mandir)/man3
#	$(INSTALL_DATA) $(srcdir)/vacall_r.3 $(DESTDIR)$(mandir)/man3/vacall_r.3
#	mkdir -p $(DESTDIR)$(datadir)
#	mkdir -p $(DESTDIR)$(htmldir)
#	$(INSTALL_DATA) $(srcdir)/vacall_r.html $(DESTDIR)$(htmldir)/vacall_r.html

installdirs : force
	mkdir -p $(DESTDIR)$(prefix)
#	mkdir -p $(DESTDIR)$(exec_prefix)
#	mkdir -p $(DESTDIR)$(libdir)
	mkdir -p $(DESTDIR)$(includedir)
#	mkdir -p $(DESTDIR)$(mandir)
#	mkdir -p $(DESTDIR)$(mandir)/man3
#	mkdir -p $(DESTDIR)$(datadir)
#	mkdir -p $(DESTDIR)$(htmldir)

uninstall : force
#	$(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libvacall.la
	$(RM) $(DESTDIR)$(includedir)/vacall_r.h
#	$(RM) $(DESTDIR)$(mandir)/man3/vacall_r.3
#	$(RM) $(DESTDIR)$(htmldir)/vacall_r.html

check : all

extracheck : all

mostlyclean : clean

clean : force
	$(RM) *.o *.lo *.a libvacall.* core
	$(RM) vacall-i386.s vacall-sparc.s vacall-sparc64.s vacall-m68k.s vacall-mips.s vacall-mipsn32.s vacall-mips64.s vacall-arm.s
	$(RM) -r .libs _libs

distclean : clean
	$(RM) config.status config.log config.cache Makefile vacall_r.h config.h libtool

maintainer-clean : distclean

force :
