# Makefile for callback

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

HOST = @host@
CPU = @HOST_CPU_C_ABI@

# 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)
LIBTOOL = @LIBTOOL@
LIBTOOL_LINK = $(LIBTOOL) --mode=link
LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
AR = ar
AR_FLAGS = rc
RANLIB = @RANLIB@
LN_S = @LN_S@
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 = .

all : all-subdirs callback.h vacall_r.h trampoline_r.h libcallback.la $(srcdir)/callback.3 $(srcdir)/callback.html

all-subdirs : force
	cd @subdir@ && $(MAKE) all

callback.h :
	$(LN_S) $(srcdir)/callback.h.in callback.h

vacall_r.h :
	$(LN_S) vacall_r/vacall_r.h vacall_r.h

trampoline_r.h :
	$(LN_S) trampoline_r/trampoline_r.h trampoline_r.h

libcallback.la : vacall_r/libvacall.la trampoline_r/libtrampoline.la
	$(LIBTOOL_LINK) $(CC) -static -o libcallback.la -rpath $(libdir) vacall_r/vacall.lo vacall_r/misc.lo vacall_r/structcpy.lo trampoline_r/*.lo

# 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
	cd @subdir@ && $(MAKE) install-lib libdir='$(libdir)' includedir='$(includedir)'
	mkdir -p $(libdir)
	$(LIBTOOL_INSTALL) $(INSTALL_DATA) libcallback.la $(libdir)/libcallback.la
	mkdir -p $(includedir)
	$(INSTALL_DATA) callback.h $(includedir)/callback.h

install : force
	cd @subdir@ && $(MAKE) install
	mkdir -p $(DESTDIR)$(prefix)
	mkdir -p $(DESTDIR)$(exec_prefix)
	mkdir -p $(DESTDIR)$(libdir)
	$(LIBTOOL_INSTALL) $(INSTALL_DATA) libcallback.la $(DESTDIR)$(libdir)/libcallback.la
	mkdir -p $(DESTDIR)$(includedir)
	$(INSTALL_DATA) callback.h $(DESTDIR)$(includedir)/callback.h
	mkdir -p $(DESTDIR)$(mandir)
	mkdir -p $(DESTDIR)$(mandir)/man3
	$(INSTALL_DATA) $(srcdir)/callback.3 $(DESTDIR)$(mandir)/man3/callback.3
	mkdir -p $(DESTDIR)$(datadir)
	mkdir -p $(DESTDIR)$(htmldir)
	$(INSTALL_DATA) $(srcdir)/callback.html $(DESTDIR)$(htmldir)/callback.html

installdirs : force
	cd @subdir@ && $(MAKE) installdirs
	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
	cd @subdir@ && $(MAKE) uninstall
	$(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libcallback.la
	$(RM) $(DESTDIR)$(includedir)/callback.h
	$(RM) $(DESTDIR)$(mandir)/man3/callback.3
	$(RM) $(DESTDIR)$(htmldir)/callback.html

minitests.o : $(srcdir)/minitests.c $(srcdir)/tests.c callback.h vacall_r.h trampoline_r.h
	$(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/minitests.c

minitests.s : $(srcdir)/minitests.c $(srcdir)/tests.c callback.h vacall_r.h trampoline_r.h
	$(CC) $(CFLAGS) $(INCLUDES) -S $(srcdir)/minitests.c

minitests : minitests.o libcallback.la
	$(LIBTOOL_LINK) $(CC) $(CFLAGS) @GCC_X_NONE@ minitests.o libcallback.la -o minitests

check-subdirs : force
	cd @subdir@ && $(MAKE) check

check : all check-subdirs minitests
	./minitests > minitests.out
	LC_ALL=C uniq -u < minitests.out > minitests.output.$(HOST)
	test '!' -s minitests.output.$(HOST)

tests.o : $(srcdir)/tests.c callback.h vacall_r.h trampoline_r.h
	$(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/tests.c

tests.s : $(srcdir)/tests.c callback.h vacall_r.h trampoline_r.h
	$(CC) $(CFLAGS) $(INCLUDES) -S $(srcdir)/tests.c

tests : tests.o libcallback.la
	$(LIBTOOL_LINK) $(CC) $(CFLAGS) @GCC_X_NONE@ tests.o libcallback.la -o tests

extracheck-subdirs : force
	cd @subdir@ && $(MAKE) extracheck

extracheck : all extracheck-subdirs tests
	./tests > tests.out
	LC_ALL=C uniq -u < tests.out > tests.output.$(HOST)
	test '!' -s tests.output.$(HOST)

mostlyclean : force
	cd @subdir@ && $(MAKE) mostlyclean

clean-subdirs : force
	cd @subdir@ && $(MAKE) clean

clean : clean-subdirs
	$(RM) *.o *.lo core
	$(RM) callback.h vacall_r.h trampoline_r.h libcallback.*
	$(RM) -r .libs _libs
	$(RM) minitests.o minitests.s minitests minitests.out
	$(RM) tests.o tests.s tests tests.out

distclean-subdirs : force
	cd @subdir@ && if test -f Makefile; then $(MAKE) distclean; fi

distclean : clean distclean-subdirs
	$(RM) config.status config.log config.cache Makefile libtool minitests.output.* tests.output.*

maintainer-clean-subdirs : force
	cd @subdir@ && if test -f Makefile; then $(MAKE) maintainer-clean; fi

maintainer-clean : distclean maintainer-clean-subdirs
	$(RM) config.status config.log config.cache Makefile

force :
