summaryrefslogtreecommitdiff
path: root/ccan/nfs/Makefile
blob: 76b9b9b929c148b7d343cf382ef533c8b61cd57e (plain)
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
CC=gcc
CFLAGS=-g -O0 -Wall -W -I../..
LIBS=

LIBNFS_OBJ = libnfs-raw-mount.o libnfs-raw-portmap.o libnfs-raw-nfs.o libnfs-raw-nfsacl.o mount.o nfs.o nfsacl.o portmap.o pdu.o init.o socket.o libnfs.o libnfs-sync.o

LICENSE_LINE = echo '/* Licensed under GPLv3+ - see LICENSE file for details */' > $@

all: tools/nfsclient-raw tools/nfsclient-async tools/nfsclient-sync

tools/nfsclient-async: tools/nfsclient-async.c libnfs.a
	$(CC) $(CFLAGS) -o $@ tools/nfsclient-async.c libnfs.a $(LIBS)

tools/nfsclient-sync: tools/nfsclient-sync.c libnfs.a
	$(CC) $(CFLAGS) -o $@ tools/nfsclient-sync.c libnfs.a $(LIBS)

tools/nfsclient-raw: tools/nfsclient-raw.c libnfs.a
	$(CC) $(CFLAGS) -o $@ tools/nfsclient-raw.c libnfs.a $(LIBS)

libnfs.a: $(LIBNFS_OBJ)
	@echo Creating library $@
	ar r libnfs.a $(LIBNFS_OBJ) 
	ranlib libnfs.a

rpc/mount.h: rpc/mount.x
	@echo Generating $@
	$(LICENSE_LINE) && rpcgen -h rpc/mount.x >> $@

libnfs-raw-mount.c: rpc/mount.x
	@echo Generating $@
	$(LICENSE_LINE) && rpcgen -c rpc/mount.x >> $@

libnfs-raw-mount.o: libnfs-raw-mount.c rpc/mount.h
	@echo Compiling $@
	gcc -g -c libnfs-raw-mount.c -o $@

rpc/nfs.h: rpc/nfs.x
	@echo Generating $@
	$(LICENSE_LINE) && rpcgen -h rpc/nfs.x >> $@

libnfs-raw-nfs.c: rpc/nfs.x
	@echo Generating $@
	$(LICENSE_LINE) && rpcgen -c rpc/nfs.x >> $@

libnfs-raw-nfs.o: libnfs-raw-nfs.c rpc/nfs.h
	@echo Compiling $@
	gcc -g -c libnfs-raw-nfs.c -o $@

rpc/nfsacl.h: rpc/nfsacl.x
	@echo Generating $@
	$(LICENSE_LINE) && rpcgen -h rpc/nfsacl.x >> $@

libnfs-raw-nfsacl.c: rpc/nfsacl.x
	@echo Generating $@
	$(LICENSE_LINE) && rpcgen -c rpc/nfsacl.x >> $@

libnfs-raw-nfsacl.o: libnfs-raw-nfsacl.c rpc/nfsacl.h
	@echo Compiling $@
	gcc -g -c libnfs-raw-nfsacl.c -o $@

rpc/portmap.h: rpc/portmap.x
	@echo Generating $@
	$(LICENSE_LINE) && rpcgen -h rpc/portmap.x >> $@

libnfs-raw-portmap.c: rpc/portmap.x
	@echo Generating $@
	$(LICENSE_LINE) && rpcgen -c rpc/portmap.x >> $@

libnfs-raw-portmap.o: libnfs-raw-portmap.c rpc/portmap.h
	@echo Compiling $@
	gcc -g -c libnfs-raw-portmap.c -o $@

clean:
	rm -f *.o
	rm -f *.a
	rm -f rpc/mount.h libnfs-raw-mount.c
	rm -f rpc/nfs.h libnfs-raw-nfs.c
	rm -f rpc/nfsacl.h libnfs-raw-nfsacl.c
	rm -f rpc/portmap.h libnfs-raw-portmap.c
	rm -f tools/nfsclient-raw tools/nfsclient-async tools/nfsclient-sync