Makefile

changeset 28
72a98cbcb9f1
parent 23
778388400f7b
child 32
51d6e45a7592
     1.1 --- a/Makefile	Thu Jan 26 15:55:52 2012 +0100
     1.2 +++ b/Makefile	Thu Feb 02 14:17:35 2012 +0100
     1.3 @@ -1,8 +1,43 @@
     1.4 -CC = gcc
     1.5 -CARG = -Wall -std=gnu99 -O
     1.6 -BUILDDIR = build/
     1.7 -OBJ = $(shell ls | grep '\.c' | sed 's/^\([^.]*\)\.c$$/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ')
     1.8 -BIN = ${BUILDDIR}cline
     1.9 +#
    1.10 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
    1.11 +#
    1.12 +# Copyright 2011 Mike Becker. All rights reserved.
    1.13 +# 
    1.14 +# Redistribution and use in source and binary forms, with or without
    1.15 +# modification, are permitted provided that the following conditions are met:
    1.16 +# 
    1.17 +# 1. Redistributions of source code must retain the above copyright
    1.18 +# notice, this list of conditions and the following disclaimer.
    1.19 +# 
    1.20 +# 2. Redistributions in binary form must reproduce the above copyright
    1.21 +# notice, this list of conditions and the following disclaimer in the
    1.22 +# documentation and/or other materials provided with the distribution.
    1.23 +# 
    1.24 +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    1.25 +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.26 +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    1.27 +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
    1.28 +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.29 +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    1.30 +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    1.31 +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.32 +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    1.33 +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    1.34 +#
    1.35 +# available configurations:
    1.36 +#   gcc (default)    (will use libc regex implicitly)
    1.37 +#   mingw            (will use libregex as static lib)
    1.38 +#
    1.39 +# debug configurations:
    1.40 +#   gcc-debug
    1.41 +#   mingw-debug
    1.42 +#
    1.43 +
    1.44 +#ifndef CONF
    1.45 +CONF = gcc
    1.46 +#endif
    1.47 +
    1.48 +include ${CONF}.mk
    1.49  
    1.50  .PHONY: setup run-compile teardown
    1.51  
    1.52 @@ -13,11 +48,11 @@
    1.53  	-${MAKE} compile
    1.54  
    1.55  compile: ${OBJ}
    1.56 -	${CC} -o ${BIN} ${OBJ}
    1.57 +	${LD} -o ${BIN} ${OBJ} ${LDFLAGS}
    1.58  
    1.59  setup:
    1.60  	mkdir -p ${BUILDDIR}
    1.61 -	rm -f build/cline.o
    1.62 +	rm -f ${BUILDDIR}cline.o
    1.63  	mv cline.h cline.src
    1.64  	cat cline.src | sed "s/VERSION.*/VERSION=\"$(shell hg identify -n) ($(shell hg identify -i))\";/g" > cline.h
    1.65  	
    1.66 @@ -26,8 +61,8 @@
    1.67  	mv cline.src cline.h
    1.68  
    1.69  ${BUILDDIR}%.o: %.c
    1.70 -	${CC} ${CARG} -c -o ${BUILDDIR}$*.o $<
    1.71 +	${CC} ${CFLAGS} -c -o ${BUILDDIR}$*.o $<
    1.72  
    1.73  clean:
    1.74 -	rm -f build/*
    1.75 +	rm -f ${BUILDDIR}*.o
    1.76  	
    1.77 \ No newline at end of file

mercurial