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
     1.1 --- a/Makefile	Fri Dec 28 15:44:28 2012 +0100
     1.2 +++ b/Makefile	Fri Dec 28 16:25:07 2012 +0100
     1.3 @@ -38,39 +38,24 @@
     1.4  #endif
     1.5  
     1.6  VERSION_PREFIX=1.0.
     1.7 -SRCDIR=src/
     1.8 -BUILDDIR=build/
     1.9 -OBJ = $(shell ls ${SRCDIR} | grep '\.c' | sed 's/^\([^.]*\)\.c$$/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ')
    1.10 -BIN = ${BUILDDIR}cline
    1.11 +SRCDIR=src
    1.12 +BUILDDIR=build
    1.13 +OBJ = arguments.o bfile_heuristics.o cline.o regex_parser.o scanner.o settings.o stream.o string_list.o suffix_fnc.o
    1.14 +BIN = $(BUILDDIR)/cline
    1.15  
    1.16 -include ${CONF}.mk
    1.17 +include $(CONF).mk
    1.18  
    1.19 -.PHONY: setup run-compile teardown
    1.20 +all: $(BUILDDIR) compile
    1.21  
    1.22 -all: setup run-compile teardown
    1.23 +compile: $(OBJ:%=$(BUILDDIR)/%)
    1.24 +	$(LD) -o $(BIN) $^ $(LDFLAGS)
    1.25  	
    1.26 -	
    1.27 -run-compile:
    1.28 -	-${MAKE} compile
    1.29 +$(BUILDDIR):
    1.30 +	mkdir $(BUILDDIR)
    1.31  
    1.32 -compile: ${OBJ}
    1.33 -	${LD} -o ${BIN} ${OBJ} ${LDFLAGS}
    1.34 -
    1.35 -setup: ${BUILDDIR}
    1.36 -	rm -f ${BUILDDIR}cline.o
    1.37 -	mv ${SRCDIR}cline.h ${SRCDIR}cline.src
    1.38 -	cat ${SRCDIR}cline.src | sed "s/VERSION.*/VERSION=\"${VERSION_PREFIX}$(shell hg identify -n) ($(shell hg identify -i))\";/g" > ${SRCDIR}cline.h
    1.39 -	
    1.40 -${BUILDDIR}:
    1.41 -	mkdir ${BUILDDIR}
    1.42 -	
    1.43 -teardown:
    1.44 -	rm -f ${SRCDIR}cline.h
    1.45 -	mv ${SRCDIR}cline.src ${SRCDIR}cline.h
    1.46 -
    1.47 -${BUILDDIR}%.o: ${SRCDIR}%.c
    1.48 -	${CC} ${CFLAGS} -c -o ${BUILDDIR}$*.o $<
    1.49 +$(BUILDDIR)/%.o: $(SRCDIR)/%.c
    1.50 +	$(CC) $(CFLAGS) -c -o $@ $<
    1.51  
    1.52  clean:
    1.53 -	rm -f ${BUILDDIR}*.o
    1.54 +	rm -f $(BUILDDIR)/*.o
    1.55  	
    1.56 \ No newline at end of file
     2.1 --- a/src/cline.c	Fri Dec 28 15:44:28 2012 +0100
     2.2 +++ b/src/cline.c	Fri Dec 28 16:25:07 2012 +0100
     2.3 @@ -78,7 +78,7 @@
     2.4  }
     2.5  
     2.6  int exit_with_version(settings_t* settings) {
     2.7 -  printf("cline - Revision: %s\n", VERSION);
     2.8 +  printf("cline - Version: %s\n", VERSION);
     2.9    destroy_settings_t(settings);
    2.10    return 0;
    2.11  }
     3.1 --- a/src/cline.h	Fri Dec 28 15:44:28 2012 +0100
     3.2 +++ b/src/cline.h	Fri Dec 28 16:25:07 2012 +0100
     3.3 @@ -32,7 +32,7 @@
     3.4  #ifndef CLINE_H_
     3.5  #define CLINE_H_
     3.6  
     3.7 -const char* VERSION=""; /* will be replaced by makefile */
     3.8 +const char* VERSION="1.0.35";
     3.9  
    3.10  #include "stdinc.h"
    3.11  #include "settings.h"

mercurial