simplified makefile

Fri, 28 Dec 2012 16:25:07 +0100

author
Mike Becker <universe@uap-core.de>
date
Fri, 28 Dec 2012 16:25:07 +0100
changeset 35
35120de6ee53
parent 34
fa9bda32de17
child 36
a7ff583e153f

simplified makefile

Makefile file | annotate | diff | comparison | revisions
src/cline.c file | annotate | diff | comparison | revisions
src/cline.h file | annotate | diff | comparison | revisions
--- 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
--- a/src/cline.c	Fri Dec 28 15:44:28 2012 +0100
+++ b/src/cline.c	Fri Dec 28 16:25:07 2012 +0100
@@ -78,7 +78,7 @@
 }
 
 int exit_with_version(settings_t* settings) {
-  printf("cline - Revision: %s\n", VERSION);
+  printf("cline - Version: %s\n", VERSION);
   destroy_settings_t(settings);
   return 0;
 }
--- a/src/cline.h	Fri Dec 28 15:44:28 2012 +0100
+++ b/src/cline.h	Fri Dec 28 16:25:07 2012 +0100
@@ -32,7 +32,7 @@
 #ifndef CLINE_H_
 #define CLINE_H_
 
-const char* VERSION=""; /* will be replaced by makefile */
+const char* VERSION="1.0.35";
 
 #include "stdinc.h"
 #include "settings.h"

mercurial