136 lines
4.7 KiB
Makefile
136 lines
4.7 KiB
Makefile
prefix = @prefix@
|
|
exec_prefix = @exec_prefix@
|
|
libdir = @libdir@
|
|
includedir = @includedir@
|
|
bindir = @bindir@
|
|
LIBS=@LIBS@
|
|
INSTALLCMD = @install@ -c
|
|
is_darwin=@is_darwin@
|
|
ENABLE_EXAMPLES=@ENABLE_EXAMPLES@
|
|
|
|
CC=@CC@
|
|
CFLAGS=@CFLAGS@ -g -O0 -fPIC -Wall -W -I. -Iinclude -Imount -Infs -Iportmap -Irquota "-D_U_=__attribute__((unused))" -D_FILE_OFFSET_BITS=64
|
|
|
|
LIBNFS_A=lib/libnfs.a
|
|
VERSION=1.0.0
|
|
|
|
ifeq ("$(is_darwin)","yes")
|
|
LIBNFS_SO_NAME=libnfs.1.dylib
|
|
LIBNFS_SO=lib/libnfs.$(VERSION).dylib
|
|
LDFLAGS+=@CFLAGS@ -dynamiclib
|
|
RPCGEN_DEF=-DU_INT64_PLATTFORM_TYPE="u_int64_t"
|
|
else
|
|
LIBNFS_SO_NAME=libnfs.so.1
|
|
LIBNFS_SO=lib/libnfs.so.$(VERSION)
|
|
LDFLAGS+=@CFLAGS@ -shared -Wl,-soname=$(LIBNFS_SO_NAME)
|
|
endif
|
|
|
|
LIB_OBJS = lib/pdu.o lib/init.o lib/socket.o \
|
|
lib/libnfs.o lib/libnfs-sync.o
|
|
|
|
LIBNFS_OBJS = \
|
|
mount/libnfs-raw-mount.o mount/mount.o \
|
|
portmap/libnfs-raw-portmap.o portmap/portmap.o \
|
|
nfs/libnfs-raw-nfs.o nfs/nfs.o \
|
|
rquota/libnfs-raw-rquota.o rquota/rquota.o
|
|
|
|
ifeq ("$(ENABLE_EXAMPLES)","yes")
|
|
EXAMPLES=bin/nfsclient-raw bin/nfsclient-async bin/nfsclient-sync
|
|
endif
|
|
|
|
all: $(LIBNFS_SO) $(EXAMPLES)
|
|
|
|
bin/nfsclient-async: examples/nfsclient-async.c $(LIBNFS_A)
|
|
mkdir -p bin
|
|
$(CC) $(CFLAGS) -o $@ examples/nfsclient-async.c $(LIBNFS_A) $(LIBS)
|
|
|
|
bin/nfsclient-sync: examples/nfsclient-sync.c $(LIBNFS_A)
|
|
mkdir -p bin
|
|
$(CC) $(CFLAGS) -o $@ examples/nfsclient-sync.c $(LIBNFS_A) $(LIBS)
|
|
|
|
bin/nfsclient-raw: examples/nfsclient-raw.c $(LIBNFS_A)
|
|
mkdir -p bin
|
|
$(CC) $(CFLAGS) -o $@ examples/nfsclient-raw.c $(LIBNFS_A) $(LIBS)
|
|
|
|
$(LIBNFS_A): $(LIBNFS_OBJS) $(LIB_OBJS)
|
|
@echo Creating library $@
|
|
ar r $(LIBNFS_A) $(LIBNFS_OBJS) $(LIB_OBJS)
|
|
ranlib $(LIBNFS_A)
|
|
|
|
$(LIBNFS_SO): $(LIBNFS_OBJS) $(LIB_OBJS)
|
|
@echo Creating shared library $@
|
|
$(CC) $(LDFLAGS) -o $@ $(LIBNFS_OBJS) $(LIB_OBJS)
|
|
|
|
portmap/libnfs-raw-portmap.h: portmap/portmap.x
|
|
@echo Generating $@
|
|
rpcgen $(RPCGEN_DEF) -h portmap/portmap.x > portmap/libnfs-raw-portmap.h
|
|
|
|
portmap/libnfs-raw-portmap.c: portmap/portmap.x
|
|
@echo Generating $@
|
|
rpcgen $(RPCGEN_DEF) -c portmap/portmap.x | sed -e "s/#include \".*portmap.h\"/#include \"libnfs-raw-portmap.h\"/" > portmap/libnfs-raw-portmap.c
|
|
|
|
portmap/libnfs-raw-portmap.o: portmap/libnfs-raw-portmap.c portmap/libnfs-raw-portmap.h
|
|
@echo Compiling $@
|
|
$(CC) $(CFLAGS) -c portmap/libnfs-raw-portmap.c -o $@
|
|
|
|
mount/libnfs-raw-mount.h: mount/mount.x
|
|
@echo Generating $@
|
|
rpcgen $(RPCGEN_DEF) -h mount/mount.x > mount/libnfs-raw-mount.h
|
|
|
|
mount/libnfs-raw-mount.c: mount/mount.x
|
|
@echo Generating $@
|
|
rpcgen $(RPCGEN_DEF) -c mount/mount.x | sed -e "s/#include \".*mount.h\"/#include \"libnfs-raw-mount.h\"/" > mount/libnfs-raw-mount.c
|
|
|
|
mount/libnfs-raw-mount.o: mount/libnfs-raw-mount.c mount/libnfs-raw-mount.h
|
|
@echo Compiling $@
|
|
$(CC) $(CFLAGS) -c mount/libnfs-raw-mount.c -o $@
|
|
|
|
nfs/libnfs-raw-nfs.h: nfs/nfs.x
|
|
@echo Generating $@
|
|
rpcgen $(RPCGEN_DEF) -h nfs/nfs.x > nfs/libnfs-raw-nfs.h
|
|
|
|
nfs/libnfs-raw-nfs.c: nfs/nfs.x
|
|
@echo Generating $@
|
|
rpcgen $(RPCGEN_DEF) -c nfs/nfs.x | sed -e "s/#include \".*nfs.h\"/#include \"libnfs-raw-nfs.h\"/" > nfs/libnfs-raw-nfs.c
|
|
|
|
nfs/libnfs-raw-nfs.o: nfs/libnfs-raw-nfs.c nfs/libnfs-raw-nfs.h
|
|
@echo Compiling $@
|
|
$(CC) $(CFLAGS) -c nfs/libnfs-raw-nfs.c -o $@
|
|
|
|
rquota/libnfs-raw-rquota.h: rquota/rquota.x
|
|
@echo Generating $@
|
|
rpcgen $(RPCGEN_DEF) -h rquota/rquota.x > rquota/libnfs-raw-rquota.h
|
|
|
|
rquota/libnfs-raw-rquota.c: rquota/rquota.x
|
|
@echo Generating $@
|
|
rpcgen $(RPCGEN_DEF) -c rquota/rquota.x | sed -e "s/#include \".*rquota.h\"/#include \"libnfs-raw-rquota.h\"/" > rquota/libnfs-raw-rquota.c
|
|
|
|
rquota/libnfs-raw-rquota.o: rquota/libnfs-raw-rquota.c rquota/libnfs-raw-rquota.h
|
|
@echo Compiling $@
|
|
$(CC) $(CFLAGS) -c rquota/libnfs-raw-rquota.c -o $@
|
|
|
|
install: $(LIBNFS_A) $(LIBNFS_SO)
|
|
mkdir -p $(DESTDIR)$(libdir)
|
|
$(INSTALLCMD) -m 755 $(LIBNFS_SO) $(DESTDIR)$(libdir)
|
|
$(INSTALLCMD) -m 755 $(LIBNFS_A) $(DESTDIR)$(libdir)
|
|
@ldconfig@
|
|
mkdir -p $(DESTDIR)$(includedir)/nfsc
|
|
$(INSTALLCMD) -m 644 include/libnfs.h $(DESTDIR)$(includedir)/nfsc
|
|
$(INSTALLCMD) -m 644 include/libnfs-private.h $(DESTDIR)$(includedir)/nfsc
|
|
$(INSTALLCMD) -m 644 mount/libnfs-raw-mount.h $(DESTDIR)$(includedir)/nfsc
|
|
$(INSTALLCMD) -m 644 nfs/libnfs-raw-nfs.h $(DESTDIR)$(includedir)/nfsc
|
|
$(INSTALLCMD) -m 644 portmap/libnfs-raw-portmap.h $(DESTDIR)$(includedir)/nfsc
|
|
|
|
distclean: clean
|
|
rm -f config.h config.log config.status configure Makefile
|
|
|
|
clean:
|
|
rm -rf bin/*
|
|
rm -f lib/*.o lib/*.a $(LIBNFS_SO)
|
|
rm -f mount/*.o mount/libnfs-raw-mount.h mount/libnfs-raw-mount.c
|
|
rm -f nfs/*.o nfs/libnfs-raw-nfs.h nfs/libnfs-raw-nfs.c
|
|
rm -f portmap/*.o portmap/libnfs-raw-portmap.h portmap/libnfs-raw-portmap.c
|
|
rm -f rquota/*.o rquota/libnfs-raw-rquota.h rquota/libnfs-raw-rquota.c
|
|
rm -f nfsclient-raw nfsclient-async nfsclient-sync
|
|
|