changed makefile to auto-include any source file

Fri, 16 Sep 2011 09:59:20 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 16 Sep 2011 09:59:20 +0200
changeset 13
51b1ba3776b1
parent 12
902cb8d2053c
child 14
ee9333c91dda

changed makefile to auto-include any source file

Makefile file | annotate | diff | comparison | revisions
--- a/Makefile	Fri Sep 16 09:14:59 2011 +0200
+++ b/Makefile	Fri Sep 16 09:59:20 2011 +0200
@@ -1,14 +1,14 @@
 CC = gcc
-BUILDDIR = build
-OBJ = ${BUILDDIR}/cline.o ${BUILDDIR}/scanner.o ${BUILDDIR}/settings.o ${BUILDDIR}/suffix_fnc.o ${BUILDDIR}/suffix_list.o ${BUILDDIR}/arguments.o
+BUILDDIR = build/
+OBJ = $(shell ls | grep \.c | sed 's/^\([^.]*\)\.c/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ')
 BIN = ${BUILDDIR}/cline
 
 all: ${OBJ}
 	${CC} -o ${BIN} ${OBJ}
 
-${BUILDDIR}/%.o: %.c
+${BUILDDIR}%.o: %.c
 	mkdir -p ${BUILDDIR}
-	${CC} -c -std=c99 -o ${BUILDDIR}/$*.o $<
+	${CC} -c -std=c99 -o ${BUILDDIR}$*.o $<
 
 clean:
 	rm build/*

mercurial