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