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 | |
05a777d9 | 10 | CFLAGS=-g -O0 -fPIC -Wall -W -I. -Iinclude -Imount -Infs -Iportmap -Irquota "-D_U_=__attribute__((unused))" -D_FILE_OFFSET_BITS=64 |
84004dbf RS |
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 \ | |
05a777d9 RS |
23 | nfs/libnfs-raw-nfs.o nfs/nfs.o \ |
24 | rquota/libnfs-raw-rquota.o rquota/rquota.o | |
84004dbf RS |
25 | |
26 | EXAMPLES=bin/nfsclient-raw bin/nfsclient-async bin/nfsclient-sync | |
27 | ||
28 | all: $(LIBNFS_SO) $(EXAMPLES) | |
29 | ||
30 | bin/nfsclient-async: examples/nfsclient-async.c $(LIBNFS_A) | |
31 | mkdir -p bin | |
32 | $(CC) $(CFLAGS) -o $@ examples/nfsclient-async.c $(LIBNFS_A) $(LIBS) | |
33 | ||
34 | bin/nfsclient-sync: examples/nfsclient-sync.c $(LIBNFS_A) | |
35 | mkdir -p bin | |
36 | $(CC) $(CFLAGS) -o $@ examples/nfsclient-sync.c $(LIBNFS_A) $(LIBS) | |
37 | ||
38 | bin/nfsclient-raw: examples/nfsclient-raw.c $(LIBNFS_A) | |
39 | mkdir -p bin | |
40 | $(CC) $(CFLAGS) -o $@ examples/nfsclient-raw.c $(LIBNFS_A) $(LIBS) | |
41 | ||
42 | $(LIBNFS_A): $(LIBNFS_OBJS) $(LIB_OBJS) | |
43 | @echo Creating library $@ | |
44 | ar r $(LIBNFS_A) $(LIBNFS_OBJS) $(LIB_OBJS) | |
45 | ranlib $(LIBNFS_A) | |
46 | ||
47 | $(LIBNFS_SO): $(LIBNFS_OBJS) $(LIB_OBJS) | |
48 | @echo Creating shared library $@ | |
49 | $(CC) -shared -Wl,-soname=$(LIBNFS_SO_NAME) -o $@ $(LIBNFS_OBJS) $(LIB_OBJS) | |
50 | ||
51 | portmap/libnfs-raw-portmap.h: portmap/portmap.x | |
52 | @echo Generating $@ | |
53 | rpcgen -h portmap/portmap.x > portmap/libnfs-raw-portmap.h | |
54 | ||
55 | portmap/libnfs-raw-portmap.c: portmap/portmap.x | |
56 | @echo Generating $@ | |
57 | rpcgen -c portmap/portmap.x | sed -e "s/#include \"portmap\/portmap.h\"/#include \"libnfs-raw-portmap.h\"/" > portmap/libnfs-raw-portmap.c | |
58 | ||
59 | portmap/libnfs-raw-portmap.o: portmap/libnfs-raw-portmap.c portmap/libnfs-raw-portmap.h | |
60 | @echo Compiling $@ | |
61 | $(CC) $(CFLAGS) -c portmap/libnfs-raw-portmap.c -o $@ | |
62 | ||
63 | mount/libnfs-raw-mount.h: mount/mount.x | |
64 | @echo Generating $@ | |
65 | rpcgen -h mount/mount.x > mount/libnfs-raw-mount.h | |
66 | ||
67 | mount/libnfs-raw-mount.c: mount/mount.x | |
68 | @echo Generating $@ | |
69 | rpcgen -c mount/mount.x | sed -e "s/#include \"mount\/mount.h\"/#include \"libnfs-raw-mount.h\"/" > mount/libnfs-raw-mount.c | |
70 | ||
71 | mount/libnfs-raw-mount.o: mount/libnfs-raw-mount.c mount/libnfs-raw-mount.h | |
72 | @echo Compiling $@ | |
73 | $(CC) $(CFLAGS) -c mount/libnfs-raw-mount.c -o $@ | |
74 | ||
75 | nfs/libnfs-raw-nfs.h: nfs/nfs.x | |
76 | @echo Generating $@ | |
77 | rpcgen -h nfs/nfs.x > nfs/libnfs-raw-nfs.h | |
78 | ||
79 | nfs/libnfs-raw-nfs.c: nfs/nfs.x | |
80 | @echo Generating $@ | |
81 | rpcgen -c nfs/nfs.x | sed -e "s/#include \"nfs\/nfs.h\"/#include \"libnfs-raw-nfs.h\"/" > nfs/libnfs-raw-nfs.c | |
82 | ||
83 | nfs/libnfs-raw-nfs.o: nfs/libnfs-raw-nfs.c nfs/libnfs-raw-nfs.h | |
84 | @echo Compiling $@ | |
85 | $(CC) $(CFLAGS) -c nfs/libnfs-raw-nfs.c -o $@ | |
86 | ||
05a777d9 RS |
87 | rquota/libnfs-raw-rquota.h: rquota/rquota.x |
88 | @echo Generating $@ | |
89 | rpcgen -h rquota/rquota.x > rquota/libnfs-raw-rquota.h | |
90 | ||
91 | rquota/libnfs-raw-rquota.c: rquota/rquota.x | |
92 | @echo Generating $@ | |
93 | rpcgen -c rquota/rquota.x | sed -e "s/#include \"rquota\/rquota.h\"/#include \"libnfs-raw-rquota.h\"/" > rquota/libnfs-raw-rquota.c | |
94 | ||
95 | rquota/libnfs-raw-rquota.o: rquota/libnfs-raw-rquota.c rquota/libnfs-raw-rquota.h | |
96 | @echo Compiling $@ | |
97 | $(CC) $(CFLAGS) -c rquota/libnfs-raw-rquota.c -o $@ | |
98 | ||
84004dbf RS |
99 | install: $(LIBNFS_A) $(LIBNFS_SO) |
100 | ifeq ("$(LIBDIR)x","x") | |
101 | $(INSTALLCMD) -m 755 $(LIBNFS_SO) $(libdir) | |
102 | $(INSTALLCMD) -m 755 $(LIBNFS_A) $(libdir) | |
103 | @ldconfig@ | |
104 | else | |
105 | $(INSTALLCMD) -m 755 $(LIBISCSI_SO) $(LIBDIR) | |
106 | $(INSTALLCMD) -m 755 $(LIBNFS_A) $(LIBDIR) | |
107 | endif | |
108 | mkdir -p $(DESTDIR)/usr/include/nfsc | |
109 | $(INSTALLCMD) -m 644 include/libnfs.h $(DESTDIR)/usr/include/nfsc | |
110 | $(INSTALLCMD) -m 644 include/libnfs-private.h $(DESTDIR)/usr/include/nfsc | |
111 | $(INSTALLCMD) -m 644 mount/libnfs-raw-mount.h $(DESTDIR)/usr/include/nfsc | |
112 | $(INSTALLCMD) -m 644 nfs/libnfs-raw-nfs.h $(DESTDIR)/usr/include/nfsc | |
113 | $(INSTALLCMD) -m 644 portmap/libnfs-raw-portmap.h $(DESTDIR)/usr/include/nfsc | |
114 | ||
115 | distclean: clean | |
116 | rm -f config.h config.log config.status configure Makefile | |
117 | ||
118 | clean: | |
119 | rm -f bin/* lib/*.o lib/*.a $(LIBNFS_SO) | |
120 | rm -f mount/*.o mount/libnfs-raw-mount.h mount/libnfs-raw-mount.c | |
121 | rm -f nfs/*.o nfs/libnfs-raw-nfs.h nfs/libnfs-raw-nfs.c | |
122 | rm -f portmap/*.o portmap/libnfs-raw-portmap.h portmap/libnfs-raw-portmap.c | |
05a777d9 | 123 | rm -f rquota/*.o rquota/libnfs-raw-rquota.h rquota/libnfs-raw-rquota.c |
84004dbf RS |
124 | rm -f nfsclient-raw nfsclient-async nfsclient-sync |
125 |