1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#
# Makefile for the library
#
TOPDIR := ..
include $(TOPDIR)/make.common
# If some functions are missing from your C library, it's a good idea to
# insert them in libsaml.a. Copy the files you need from the "support"
# subdirectory (with the corresponding *.h files if necessary) and list
# them below. Then "make dep" to update the dependencies.
# Linux doesn't need any,
XCFILES =
XHFILES =
# whereas SunOS needs all of these:
#XCFILES = getopt.c getopt1.c strtol.c strtoul.c malloc-2.6.2.c \
# memmove.c setenv.c
#XHFILES = getopt.h
CFILES = mnode.c mref.c builtin.c promote.c errlist.c \
Void.c Mint.c Complex.c Cyclic.c Float.c Tensor.c \
Integer.c Ratio.c Literal.c Matrix.c Mono.c Poly.c \
Upoly.c Apoly.c Algext.c util.c \
simple-lexers.c simple-parser.c $(XCFILES)
HFILES = mp-arch.h builtin.h longlong.h mnode.h saml-util.h \
saml.h saml-errno.h saml-mtypes.h saml-parse.h $(XHFILES)
OFILES = $(CFILES:.c=.o)
PFILES = $(CFILES:.c=.op)
#
# Shared library support
#
PICFILES = $(CFILES:.c=.opic)
SHCC = $(CC)
SHCFLAGS = $(CFLAGS) -fPIC
SHLDFLAGS = -shared -Wl,-soname,libsaml.so.$(SLMAJ)
SHLIBS = -lc
# Version numbers
SLMAJ = 0
SLMIN = $(shell date +%y%m%d)
# The following dependency is really overkill, it will rebuild all shared
# objects every time a header is changed.
%.opic: %.c $(HFILES)
$(CC) $(CPPFLAGS) $(SHCFLAGS) -o $@ -c $<
clean: clean-shared-objects
clean-shared-objects:
rm -f *.opic
#
# Main targets
#
all: libsaml.a
profil: libsaml_p.a
shared: libsaml_pic.a libsaml.so
libsaml.a: $(OFILES)
rm -f $@
ar cr $@ $^
$(RANLIB) $@
libsaml_p.a: $(PFILES)
rm -f $@
ar cr $@ $^
$(RANLIB) $@
libsaml_pic.a: $(PICFILES)
rm -f $@
ar cr $@ $^
$(RANLIB) $@
libsaml.so: $(PICFILES)
rm -f $@*
$(CC) $(SHLDFLAGS) -o $@.$(SLMAJ).$(SLMIN) $(PICFILES) $(SHLIBS)
# ln -s $@.$(SLMAJ).$(SLMIN) $@.$(SLMAJ)
cp $@.$(SLMAJ).$(SLMIN) $@
# ln -s $@.$(SLMAJ) $@
veryclean: clean
rm -f *.s *.orig libsaml*.*
include .depend
|