# Makefile for CLISP module syscalls

srcdir = @srcdir@
CC = @CC@
# __EXTENSIONS__ is necessary so that the Solaris headers declare confstr().
# _REENTRANT is necessary so that the Solaris headers declare lgamma_r().
CPPFLAGS = @CPPFLAGS@ -D__EXTENSIONS__ -D_REENTRANT
CFLAGS = @CFLAGS@
CLISP = @CLISP@ -norc -q
CLISP_LIBDIR = @CLISP_LIBDIR@
CLISP_LINKKIT = @CLISP_LINKKIT@

LN = @LN@
LN_S = @LN_S@

MAKE = make

SHELL = /bin/sh

GENERATED = calls.o posix.fas preload.lisp datemsk
DISTRIBFILES = link.sh Makefile $(GENERATED) \
	$(srcdir)/posix.lisp $(srcdir)/README
distribdir =

# default target: make the module
clisp-module : $(GENERATED)

.PHONY : am--refresh clisp-module clisp-module-distrib clean distclean force

posix.fas: $(srcdir)/posix.lisp
	$(CLISP) -c $(srcdir)/posix.lisp -o ./

calls.m.c: $(srcdir)/calls.c
	$(CLISP) -m 2MW -C $(CLISP_LINKKIT)/modprep $(srcdir)/calls.c ./

calls.o : calls.m.c config.h
	$(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(CLISP_LINKKIT) \
		-c calls.m.c -o calls.o

config.h : $(srcdir)/config.h.in config.status
	sh config.status --header=config.h

preload.lisp : $(srcdir)/preload.lisp
	$(LN_S) $(srcdir)/preload.lisp .

datemsk : $(srcdir)/datemsk
	$(LN_S) $(srcdir)/datemsk .

# Make a module distribution into $(distribdir)
clisp-module-distrib : clisp-module force
	$(LN) $(DISTRIBFILES) $(distribdir)

clean : force
	rm -f core *.o *.a *.m.c *.fas *.lib

distclean : clean

force :

