Commit | Line | Data |
---|---|---|
84004dbf RS |
1 | prefix = @prefix@ |
2 | exec_prefix = @exec_prefix@ | |
3 | libdir = @libdir@ | |
4 | bindir = @bindir@ | |
5 | LIBS=@LIBS@ | |
6 | ||
7 | INSTALLCMD = @install@ -c | |
8 | ||
9 | CC=gcc | |
10 | CFLAGS=-g -O0 -fPIC -Wall -W -I. -Iinclude -Imount -Infs -Iportmap "-D_U_=__attribute__((unused))" -D_FILE_OFFSET_BITS=64 | |
11 | ||
12 | LIBNFS_A=lib/libnfs.a | |
13 | LIBNFS_SO_NAME=libnfs.so.1 | |
14 | VERSION=1.0.0 | |
15 | LIBNFS_SO=lib/libnfs.so.$(VERSION) | |
16 | ||
17 | LIB_OBJS = lib/pdu.o lib/init.o lib/socket.o \ | |
18 | lib/libnfs.o lib/libnfs-sync.o | |
19 | ||
20 | LIBNFS_OBJS = \ | |
21 | mount/libnfs-raw-mount.o mount/mount.o \ | |
22 | portmap/libnfs-raw-portmap.o portmap/portmap.o \ | |
23 | nfs/libnfs-raw-nfs.o nfs/nfs.o | |
24 | ||
25 | EXAMPLES=bin/nfsclient-raw bin/nfsclient-async bin/nfsclient-sync | |
26 | ||
27 | all: $(LIBNFS_SO) $(EXAMPLES) | |
28 | ||
29 | bin/nfsclient-async: examples/nfsclient-async.c $(LIBNFS_A) | |
30 | mkdir -p bin | |
31 | $(CC) $(CFLAGS) -o $@ examples/nfsclient-async.c $(LIBNFS_A) $(LIBS) | |
32 | ||
33 | bin/nfsclient-sync: examples/nfsclient-sync.c $(LIBNFS_A) | |
34 | mkdir -p bin | |
35 | $(CC) $(CFLAGS) -o $@ examples/nfsclient-sync.c $(LIBNFS_A) $(LIBS) | |
36 | ||
37 | bin/nfsclient-raw: examples/nfsclient-raw.c $(LIBNFS_A) | |
38 | mkdir -p bin | |
39 | $(CC) $(CFLAGS) -o $@ examples/nfsclient-raw.c $(LIBNFS_A) $(LIBS) | |
40 | ||
41 | $(LIBNFS_A): $(LIBNFS_OBJS) $(LIB_OBJS) | |
42 | @echo Creating library $@ | |
43 | ar r $(LIBNFS_A) $(LIBNFS_OBJS) $(LIB_OBJS) | |
44 | ranlib $(LIBNFS_A) | |
45 | ||
46 | $(LIBNFS_SO): $(LIBNFS_OBJS) $(LIB_OBJS) | |
47 | @echo Creating shared library $@ | |
48 | $(CC) -shared -Wl,-soname=$(LIBNFS_SO_NAME) -o $@ $(LIBNFS_OBJS) $(LIB_OBJS) | |
49 | ||
50 | portmap/libnfs-raw-portmap.h: portmap/portmap.x | |
51 | @echo Generating $@ | |
52 | rpcgen -h portmap/portmap.x > portmap/libnfs-raw-portmap.h | |
53 | ||
54 | portmap/libnfs-raw-portmap.c: portmap/portmap.x | |
55 | @echo Generating $@ | |
56 | rpcgen -c portmap/portmap.x | sed -e "s/#include \"portmap\/portmap.h\"/#include \"libnfs-raw-portmap.h\"/" > portmap/libnfs-raw-portmap.c | |
57 | ||
58 | portmap/libnfs-raw-portmap.o: portmap/libnfs-raw-portmap.c portmap/libnfs-raw-portmap.h | |
59 | @echo Compiling $@ | |
60 | $(CC) $(CFLAGS) -c portmap/libnfs-raw-portmap.c -o $@ | |
61 | ||
62 | mount/libnfs-raw-mount.h: mount/mount.x | |
63 | @echo Generating $@ | |
64 | rpcgen -h mount/mount.x > mount/libnfs-raw-mount.h | |
65 | ||
66 | mount/libnfs-raw-mount.c: mount/mount.x | |
67 | @echo Generating $@ | |
68 | rpcgen -c mount/mount.x | sed -e "s/#include \"mount\/mount.h\"/#include \"libnfs-raw-mount.h\"/" > mount/libnfs-raw-mount.c | |
69 | ||
70 | mount/libnfs-raw-mount.o: mount/libnfs-raw-mount.c mount/libnfs-raw-mount.h | |
71 | @echo Compiling $@ | |
72 | $(CC) $(CFLAGS) -c mount/libnfs-raw-mount.c -o $@ | |
73 | ||
74 | nfs/libnfs-raw-nfs.h: nfs/nfs.x | |
75 | @echo Generating $@ | |
76 | rpcgen -h nfs/nfs.x > nfs/libnfs-raw-nfs.h | |
77 | ||
78 | nfs/libnfs-raw-nfs.c: nfs/nfs.x | |
79 | @echo Generating $@ | |
80 | rpcgen -c nfs/nfs.x | sed -e "s/#include \"nfs\/nfs.h\"/#include \"libnfs-raw-nfs.h\"/" > nfs/libnfs-raw-nfs.c | |
81 | ||
82 | nfs/libnfs-raw-nfs.o: nfs/libnfs-raw-nfs.c nfs/libnfs-raw-nfs.h | |
83 | @echo Compiling $@ | |
84 | $(CC) $(CFLAGS) -c nfs/libnfs-raw-nfs.c -o $@ | |
85 | ||
86 | install: $(LIBNFS_A) $(LIBNFS_SO) | |
87 | ifeq ("$(LIBDIR)x","x") | |
88 | $(INSTALLCMD) -m 755 $(LIBNFS_SO) $(libdir) | |
89 | $(INSTALLCMD) -m 755 $(LIBNFS_A) $(libdir) | |
90 | @ldconfig@ | |
91 | else | |
92 | $(INSTALLCMD) -m 755 $(LIBISCSI_SO) $(LIBDIR) | |
93 | $(INSTALLCMD) -m 755 $(LIBNFS_A) $(LIBDIR) | |
94 | endif | |
95 | mkdir -p $(DESTDIR)/usr/include/nfsc | |
96 | $(INSTALLCMD) -m 644 include/libnfs.h $(DESTDIR)/usr/include/nfsc | |
97 | $(INSTALLCMD) -m 644 include/libnfs-private.h $(DESTDIR)/usr/include/nfsc | |
98 | $(INSTALLCMD) -m 644 mount/libnfs-raw-mount.h $(DESTDIR)/usr/include/nfsc | |
99 | $(INSTALLCMD) -m 644 nfs/libnfs-raw-nfs.h $(DESTDIR)/usr/include/nfsc | |
100 | $(INSTALLCMD) -m 644 portmap/libnfs-raw-portmap.h $(DESTDIR)/usr/include/nfsc | |
101 | ||
102 | distclean: clean | |
103 | rm -f config.h config.log config.status configure Makefile | |
104 | ||
105 | clean: | |
106 | rm -f bin/* lib/*.o lib/*.a $(LIBNFS_SO) | |
107 | rm -f mount/*.o mount/libnfs-raw-mount.h mount/libnfs-raw-mount.c | |
108 | rm -f nfs/*.o nfs/libnfs-raw-nfs.h nfs/libnfs-raw-nfs.c | |
109 | rm -f portmap/*.o portmap/libnfs-raw-portmap.h portmap/libnfs-raw-portmap.c | |
110 | rm -f nfsclient-raw nfsclient-async nfsclient-sync | |
111 |