AR=ar
CC=gcc
CFLAGS=-g -O0 -DAROS=1 -D_U_=" " -DHAVE_SOCKADDR_LEN -I. -Iinclude -Iinclude/nfsc -Iaros -Infs -Imount

OBJS=lib/init.o lib/libnfs.o lib/libnfs-sync.o lib/libnfs-zdr.o lib/pdu.o lib/socket.o 
OBJS+=mount/mount.o mount/libnfs-raw-mount.o 
OBJS+=nfs/nfs.o nfs/nfsacl.o nfs/libnfs-raw-nfs.o 
OBJS+=nlm/nlm.o nlm/libnfs-raw-nlm.o 
OBJS+=portmap/portmap.o portmap/libnfs-raw-portmap.o
OBJS+=rquota/rquota.o rquota/libnfs-raw-rquota.o
OBJS+=aros/aros_compat.o

EXAMPLES=examples/nfsclient-listservers examples/nfsclient-sync examples/nfs-cp examples/nfs-ls

all: lib/libnfs.a $(EXAMPLES)

lib/libnfs.a: $(OBJS)
	$(AR) cru $@ $(OBJS)

.c.o:
	echo $(CC) $(CFLAGS) -c -o $@ $<
	$(CC) $(CFLAGS) -c -o $@ $<

install: all
	cp lib/libnfs.a GCC:lib
	mkdir -p INCLUDE:nfsc
	cp include/nfsc/libnfs.h INCLUDE:nfsc
	cp include/nfsc/libnfs-raw.h INCLUDE:nfsc
	cp include/nfsc/libnfs-zdr.h INCLUDE:nfsc
	cp mount/libnfs-raw-mount.h INCLUDE:nfsc
	cp nlm/libnfs-raw-nlm.h INCLUDE:nfsc
	cp nfs/libnfs-raw-nfs.h INCLUDE:nfsc
	cp portmap/libnfs-raw-portmap.h INCLUDE:nfsc
	cp rquota/libnfs-raw-rquota.h INCLUDE:nfsc

examples/nfsclient-listservers: examples/nfsclient-listservers.c lib/libnfs.a
	$(CC) $(CFLAGS) -o $@ $< lib/libnfs.a

examples/nfsclient-sync: examples/nfsclient-sync.c lib/libnfs.a
	$(CC) $(CFLAGS) -o $@ $< lib/libnfs.a

examples/nfs-ls: examples/nfs-ls.c lib/libnfs.a
	$(CC) $(CFLAGS) -o $@ $< lib/libnfs.a

examples/nfs-cp: examples/nfs-cp.c lib/libnfs.a
	$(CC) $(CFLAGS) -o $@ $< lib/libnfs.a
