Description: SRC support
 This patch enables SRC variable support to the GNUmakefile
Author: Gerrit Pape <pape@smarden.org>

Index: libowfat-0.29/GNUmakefile
===================================================================
--- libowfat-0.29.orig/GNUmakefile	2012-04-17 23:26:31.000000000 +0200
+++ libowfat-0.29/GNUmakefile	2012-11-03 15:39:49.456558657 +0100
@@ -54,28 +54,28 @@
 # to build without diet libc support, use $ make DIET=
 # see http://www.fefe.de/dietlibc/ for details about the diet libc
 
-VPATH=str:byte:fmt:scan:uint:open:stralloc:unix:socket:buffer:mmap:textcode:taia:tai:dns:case:array:mult:io:cdb
+VPATH=$(SRC)str:$(SRC)byte:$(SRC)fmt:$(SRC)scan:$(SRC)uint:$(SRC)open:$(SRC)stralloc:$(SRC)unix:$(SRC)socket:$(SRC)buffer:$(SRC)mmap:$(SRC)textcode:$(SRC)taia:$(SRC)tai:$(SRC)dns:$(SRC)case:$(SRC)array:$(SRC)mult:$(SRC)io:$(SRC)cdb:$(SRC)
 
-BYTE_OBJS=$(patsubst byte/%.c,%.o,$(wildcard byte/*.c))
-FMT_OBJS=$(patsubst fmt/%.c,%.o,$(wildcard fmt/*.c))
-SCAN_OBJS=$(patsubst scan/%.c,%.o,$(wildcard scan/*.c))
-STR_OBJS=$(patsubst str/%.c,%.o,$(wildcard str/*.c))
-UINT_OBJS=$(patsubst uint/%.c,%.o,$(wildcard uint/*.c))
-OPEN_OBJS=$(patsubst open/%.c,%.o,$(wildcard open/*.c))
-STRALLOC_OBJS=$(patsubst stralloc/%.c,%.o,$(wildcard stralloc/*.c))
-UNIX_OBJS=$(patsubst unix/%.c,%.o,$(wildcard unix/*.c))
-SOCKET_OBJS=$(patsubst socket/%.c,%.o,$(wildcard socket/*.c))
-BUFFER_OBJS=$(patsubst buffer/%.c,%.o,$(wildcard buffer/*.c))
-MMAP_OBJS=$(patsubst mmap/%.c,%.o,$(wildcard mmap/*.c))
-TEXTCODE_OBJS=$(patsubst textcode/%.c,%.o,$(wildcard textcode/*.c))
-TAI_OBJS=$(patsubst tai/%.c,%.o,$(wildcard tai/*.c))
-TAIA_OBJS=$(patsubst taia/%.c,%.o,$(wildcard taia/*.c))
-DNS_OBJS=$(patsubst dns/%.c,%.o,$(wildcard dns/*.c))
-CASE_OBJS=$(patsubst case/%.c,%.o,$(wildcard case/*.c))
-ARRAY_OBJS=$(patsubst array/%.c,%.o,$(wildcard array/array_*.c))
-MULT_OBJS=$(patsubst mult/%.c,%.o,$(wildcard mult/*.c))
-IO_OBJS=$(patsubst io/%.c,%.o,$(wildcard io/*.c))
-CDB_OBJS=$(patsubst cdb/%.c,%.o,$(wildcard cdb/*.c))
+BYTE_OBJS=$(patsubst $(SRC)byte/%.c,%.o,$(wildcard $(SRC)byte/*.c))
+FMT_OBJS=$(patsubst $(SRC)fmt/%.c,%.o,$(wildcard $(SRC)fmt/*.c))
+SCAN_OBJS=$(patsubst $(SRC)scan/%.c,%.o,$(wildcard $(SRC)scan/*.c))
+STR_OBJS=$(patsubst $(SRC)str/%.c,%.o,$(wildcard $(SRC)str/*.c))
+UINT_OBJS=$(patsubst $(SRC)uint/%.c,%.o,$(wildcard $(SRC)uint/*.c))
+OPEN_OBJS=$(patsubst $(SRC)open/%.c,%.o,$(wildcard $(SRC)open/*.c))
+STRALLOC_OBJS=$(patsubst $(SRC)stralloc/%.c,%.o,$(wildcard $(SRC)stralloc/*.c))
+UNIX_OBJS=$(patsubst $(SRC)unix/%.c,%.o,$(wildcard $(SRC)unix/*.c))
+SOCKET_OBJS=$(patsubst $(SRC)socket/%.c,%.o,$(wildcard $(SRC)socket/*.c))
+BUFFER_OBJS=$(patsubst $(SRC)buffer/%.c,%.o,$(wildcard $(SRC)buffer/*.c))
+MMAP_OBJS=$(patsubst $(SRC)mmap/%.c,%.o,$(wildcard $(SRC)mmap/*.c))
+TEXTCODE_OBJS=$(patsubst $(SRC)textcode/%.c,%.o,$(wildcard $(SRC)textcode/*.c))
+TAI_OBJS=$(patsubst $(SRC)tai/%.c,%.o,$(wildcard $(SRC)tai/*.c))
+TAIA_OBJS=$(patsubst $(SRC)taia/%.c,%.o,$(wildcard $(SRC)taia/*.c))
+DNS_OBJS=$(patsubst $(SRC)dns/%.c,%.o,$(wildcard $(SRC)dns/*.c))
+CASE_OBJS=$(patsubst $(SRC)case/%.c,%.o,$(wildcard $(SRC)case/*.c))
+ARRAY_OBJS=$(patsubst $(SRC)array/%.c,%.o,$(wildcard $(SRC)array/array_*.c))
+MULT_OBJS=$(patsubst $(SRC)mult/%.c,%.o,$(wildcard $(SRC)mult/*.c))
+IO_OBJS=$(patsubst $(SRC)io/%.c,%.o,$(wildcard $(SRC)io/*.c))
+CDB_OBJS=$(patsubst $(SRC)cdb/%.c,%.o,$(wildcard $(SRC)cdb/*.c))
 
 $(BYTE_OBJS): byte.h
 $(FMT_OBJS): fmt.h
@@ -96,7 +96,6 @@
 $(IO_OBJS): uint64.h array.h io.h io_internal.h taia.h tai.h haveepoll.h havekqueue.h havesigio.h havebsdsf.h havedevpoll.h havesendfile.h
 $(CDB_OBJS): cdb.h uint32.h
 
-
 iob_addbuf.o iob_addfile.o iob_new.o iob_reset.o iob_send.o: iob_internal.h iob.h
 
 iopause.o: iopause.h select.h
@@ -199,87 +198,87 @@
 
 haveip6.h: tryip6.c
 	-rm -f $@
-	if $(DIET) $(CC) $(CFLAGS) -c tryip6.c >/dev/null 2>&1; then echo "#define LIBC_HAS_IP6"; fi > $@
+	if $(DIET) $(CC) $(CFLAGS) -c $< >/dev/null 2>&1; then echo "#define LIBC_HAS_IP6"; fi > $@
 	-rm -f tryip6.o
 
 havescope.h: tryscope.c
 	-rm -f $@
-	if $(DIET) $(CC) $(CFLAGS) -c tryscope.c >/dev/null 2>&1; then echo "#define LIBC_HAS_SCOPE_ID"; fi > $@
+	if $(DIET) $(CC) $(CFLAGS) -c $< >/dev/null 2>&1; then echo "#define LIBC_HAS_SCOPE_ID"; fi > $@
 	-rm -f tryscope.o
 
 haven2i.h: tryn2i.c
 	-rm -f $@
-	if $(DIET) $(CC) $(CFLAGS) -o t tryn2i.c >/dev/null 2>&1; then echo "#define HAVE_N2I"; fi > $@
+	if $(DIET) $(CC) $(CFLAGS) -o t $< >/dev/null 2>&1; then echo "#define HAVE_N2I"; fi > $@
 	-rm -f t
 
 havesl.h: trysl.c
 	-rm -f $@
-	if ! $(DIET) $(CC) $(CFLAGS) -o t trysl.c >/dev/null 2>&1; then echo "typedef int socklen_t;"; fi > $@
+	if ! $(DIET) $(CC) $(CFLAGS) -o t $< >/dev/null 2>&1; then echo "typedef int socklen_t;"; fi > $@
 	-rm -f t
 
 haveinline.h: tryinline.c
 	-rm -f $@
-	if ! $(DIET) $(CC) $(CFLAGS) -c tryinline.c >/dev/null 2>&1; then echo "#define inline"; fi > $@
+	if ! $(DIET) $(CC) $(CFLAGS) -c $< >/dev/null 2>&1; then echo "#define inline"; fi > $@
 	-rm -f tryinline.o
 
 havekqueue.h: trykqueue.c
 	-rm -f $@
-	if $(DIET) $(CC) $(CFLAGS) -c trykqueue.c >/dev/null 2>&1; then echo "#define HAVE_KQUEUE"; fi > $@
+	if $(DIET) $(CC) $(CFLAGS) -c $< >/dev/null 2>&1; then echo "#define HAVE_KQUEUE"; fi > $@
 	-rm -f trykqueue.o
 
 havebsdsf.h: trybsdsf.c
 	-rm -f $@
-	if $(DIET) $(CC) $(CFLAGS) -o trybsdsf trybsdsf.c >/dev/null 2>&1; then echo "#define HAVE_BSDSENDFILE"; fi > $@
+	if $(DIET) $(CC) $(CFLAGS) -o trybsdsf $< >/dev/null 2>&1; then echo "#define HAVE_BSDSENDFILE"; fi > $@
 	-rm -f trybsdsf.o trybsdsf
 
 havesendfile.h: trysendfile.c
 	-rm -f $@
-	if $(DIET) $(CC) $(CFLAGS) -c trysendfile.c >/dev/null 2>&1; then echo "#define HAVE_SENDFILE"; fi > $@
+	if $(DIET) $(CC) $(CFLAGS) -c $< >/dev/null 2>&1; then echo "#define HAVE_SENDFILE"; fi > $@
 	-rm -f trysendfile.o
 
 haveepoll.h: tryepoll.c
 	-rm -f $@
-	if $(DIET) $(CC) $(CFLAGS) -o tryepoll tryepoll.c >/dev/null 2>&1; then echo "#define HAVE_EPOLL 1"; else \
-	if $(DIET) $(CC) $(CFLAGS) -o tryepoll tryepoll.c -lepoll >/dev/null 2>&1; then echo "#define HAVE_EPOLL 2"; fi; fi > $@
+	if $(DIET) $(CC) $(CFLAGS) -o tryepoll $< >/dev/null 2>&1; then echo "#define HAVE_EPOLL 1"; else \
+	if $(DIET) $(CC) $(CFLAGS) -o tryepoll $< -lepoll >/dev/null 2>&1; then echo "#define HAVE_EPOLL 2"; fi; fi > $@
 	-rm -f tryepoll
 
 havedevpoll.h: trydevpoll.c
 	-rm -f $@
-	if $(DIET) $(CC) $(CFLAGS) -c trydevpoll.c >/dev/null 2>&1; then echo "#define HAVE_DEVPOLL"; fi > $@
+	if $(DIET) $(CC) $(CFLAGS) -c $< >/dev/null 2>&1; then echo "#define HAVE_DEVPOLL"; fi > $@
 	-rm -f trydevpoll.o
 
 libepoll: haveepoll.h
-	if test "z`cat haveepoll.h`" = "z#define HAVE_EPOLL 2"; then echo -lepoll; fi > $@
+	if test "z`cat $<`" = "z#define HAVE_EPOLL 2"; then echo -lepoll; fi > $@
 
 havesigio.h: trysigio.c
 	-rm -f $@
-	if $(DIET) $(CC) $(CFLAGS) -c trysigio.c >/dev/null 2>&1; then echo "#define HAVE_SIGIO"; fi > $@
+	if $(DIET) $(CC) $(CFLAGS) -c $< >/dev/null 2>&1; then echo "#define HAVE_SIGIO"; fi > $@
 	-rm -f trysigio.o
 
 havealloca.h: tryalloca.c
 	-rm -f $@
 	echo "#include <stdlib.h>" > $@
-	if $(DIET) $(CC) $(CFLAGS) -c tryalloca.c -DA >/dev/null 2>&1; then echo "#include <alloca.h>"; fi >> $@
-	if $(DIET) $(CC) $(CFLAGS) -c tryalloca.c -DB >/dev/null 2>&1; then echo "#include <malloc.h>"; fi >> $@
+	if $(DIET) $(CC) $(CFLAGS) -c $< -DA >/dev/null 2>&1; then echo "#include <alloca.h>"; fi >> $@
+	if $(DIET) $(CC) $(CFLAGS) -c $< -DB >/dev/null 2>&1; then echo "#include <malloc.h>"; fi >> $@
 	-rm -f tryalloca.o
 
 iopause.h: iopause.h1 iopause.h2 trypoll.c
 	-rm -f $@
-	if $(DIET) $(CC) $(CFLAGS) -o t trypoll.c >/dev/null 2>&1; then cp iopause.h2 iopause.h; else cp iopause.h1 iopause.h; fi
+	if $(DIET) $(CC) $(CFLAGS) -o t trypoll.c >/dev/null 2>&1; then cp $(SRC)iopause.h1 iopause.h; else cp $(SRC)iopause.h2 iopause.h; fi
 	-rm -f t
 
 select.h: select.h1 select.h2 trysysel.c
 	-rm -f $@
-	if $(DIET) $(CC) $(CFLAGS) -c trysysel.c >/dev/null 2>&1; then cp select.h2 select.h; else cp select.h1 select.h; fi
+	if $(DIET) $(CC) $(CFLAGS) -c trysysel.c >/dev/null 2>&1; then cp $(SRC)select.h1 select.h; else cp $(SRC)select.h2 select.h; fi
 	-rm -f trysysel.o
 
-libsocket: trysocket.c
-	if $(DIET) $(CC) $(CFLAGS) -o trysocket trysocket.c >/dev/null 2>&1; then echo ""; else \
-	if $(DIET) $(CC) $(CFLAGS) -o trysocket trysocket.c -lsocket >/dev/null 2>&1; then echo "-lsocket"; else \
-	if $(DIET) $(CC) $(CFLAGS) -o trysocket trysocket.c -lsocket -lnsl >/dev/null 2>&1; then echo "-lsocket -lnsl"; \
+libsocket: trysocket.c trysendfile.c
+	if $(DIET) $(CC) $(CFLAGS) -o trysocket $(SRC)trysocket.c >/dev/null 2>&1; then echo ""; else \
+	if $(DIET) $(CC) $(CFLAGS) -o trysocket $(SRC)trysocket.c -lsocket >/dev/null 2>&1; then echo "-lsocket"; else \
+	if $(DIET) $(CC) $(CFLAGS) -o trysocket $(SRC)trysocket.c -lsocket -lnsl >/dev/null 2>&1; then echo "-lsocket -lnsl"; \
 	fi; fi; fi > blah
-	if $(DIET) $(CC) $(CFLAGS) -o trysocket trysendfile.c `cat blah`>/dev/null 2>&1; then cat blah; else \
-	if $(DIET) $(CC) $(CFLAGS) -o trysocket trysendfile.c -lsendfile `cat blah` >/dev/null 2>&1; then echo "-lsendfile"; cat blah; \
+	if $(DIET) $(CC) $(CFLAGS) -o trysocket $(SRC)trysendfile.c `cat blah`>/dev/null 2>&1; then cat blah; else \
+	if $(DIET) $(CC) $(CFLAGS) -o trysocket $(SRC)trysendfile.c -lsendfile `cat blah` >/dev/null 2>&1; then echo "-lsendfile"; \
 	fi; fi > libsocket
 	rm -f blah trysocket
 
