Makefile

changeset 35
35120de6ee53
parent 34
fa9bda32de17
child 36
a7ff583e153f
--- a/Makefile	Fri Dec 28 15:44:28 2012 +0100
+++ b/Makefile	Fri Dec 28 16:25:07 2012 +0100
@@ -38,39 +38,24 @@
 #endif
 
 VERSION_PREFIX=1.0.
-SRCDIR=src/
-BUILDDIR=build/
-OBJ = $(shell ls ${SRCDIR} | grep '\.c' | sed 's/^\([^.]*\)\.c$$/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ')
-BIN = ${BUILDDIR}cline
-
-include ${CONF}.mk
+SRCDIR=src
+BUILDDIR=build
+OBJ = arguments.o bfile_heuristics.o cline.o regex_parser.o scanner.o settings.o stream.o string_list.o suffix_fnc.o
+BIN = $(BUILDDIR)/cline
 
-.PHONY: setup run-compile teardown
+include $(CONF).mk
 
-all: setup run-compile teardown
-	
-	
-run-compile:
-	-${MAKE} compile
+all: $(BUILDDIR) compile
 
-compile: ${OBJ}
-	${LD} -o ${BIN} ${OBJ} ${LDFLAGS}
-
-setup: ${BUILDDIR}
-	rm -f ${BUILDDIR}cline.o
-	mv ${SRCDIR}cline.h ${SRCDIR}cline.src
-	cat ${SRCDIR}cline.src | sed "s/VERSION.*/VERSION=\"${VERSION_PREFIX}$(shell hg identify -n) ($(shell hg identify -i))\";/g" > ${SRCDIR}cline.h
+compile: $(OBJ:%=$(BUILDDIR)/%)
+	$(LD) -o $(BIN) $^ $(LDFLAGS)
 	
-${BUILDDIR}:
-	mkdir ${BUILDDIR}
-	
-teardown:
-	rm -f ${SRCDIR}cline.h
-	mv ${SRCDIR}cline.src ${SRCDIR}cline.h
+$(BUILDDIR):
+	mkdir $(BUILDDIR)
 
-${BUILDDIR}%.o: ${SRCDIR}%.c
-	${CC} ${CFLAGS} -c -o ${BUILDDIR}$*.o $<
+$(BUILDDIR)/%.o: $(SRCDIR)/%.c
+	$(CC) $(CFLAGS) -c -o $@ $<
 
 clean:
-	rm -f ${BUILDDIR}*.o
+	rm -f $(BUILDDIR)/*.o
 	
\ No newline at end of file

mercurial