Makefile

Fri, 28 Dec 2012 15:44:28 +0100

author
Mike Becker <universe@uap-core.de>
date
Fri, 28 Dec 2012 15:44:28 +0100
changeset 34
fa9bda32de17
parent 32
51d6e45a7592
child 35
35120de6ee53
permissions
-rw-r--r--

moved src files to src subdirectory and added licence text

universe@28 1 #
universe@28 2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
universe@28 3 #
universe@28 4 # Copyright 2011 Mike Becker. All rights reserved.
universe@28 5 #
universe@28 6 # Redistribution and use in source and binary forms, with or without
universe@28 7 # modification, are permitted provided that the following conditions are met:
universe@28 8 #
universe@28 9 # 1. Redistributions of source code must retain the above copyright
universe@28 10 # notice, this list of conditions and the following disclaimer.
universe@28 11 #
universe@28 12 # 2. Redistributions in binary form must reproduce the above copyright
universe@28 13 # notice, this list of conditions and the following disclaimer in the
universe@28 14 # documentation and/or other materials provided with the distribution.
universe@28 15 #
universe@28 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
universe@28 17 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
universe@28 18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
universe@28 19 # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
universe@28 20 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
universe@28 21 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
universe@28 22 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
universe@28 23 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
universe@28 24 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
universe@28 25 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
universe@28 26 #
universe@28 27 # available configurations:
universe@28 28 # gcc (default) (will use libc regex implicitly)
universe@28 29 # mingw (will use libregex as static lib)
universe@28 30 #
universe@28 31 # debug configurations:
universe@28 32 # gcc-debug
universe@28 33 # mingw-debug
universe@28 34 #
universe@28 35
universe@28 36 #ifndef CONF
universe@28 37 CONF = gcc
universe@28 38 #endif
universe@28 39
universe@32 40 VERSION_PREFIX=1.0.
universe@34 41 SRCDIR=src/
universe@34 42 BUILDDIR=build/
universe@34 43 OBJ = $(shell ls ${SRCDIR} | grep '\.c' | sed 's/^\([^.]*\)\.c$$/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ')
universe@34 44 BIN = ${BUILDDIR}cline
universe@32 45
universe@28 46 include ${CONF}.mk
universe@0 47
universe@16 48 .PHONY: setup run-compile teardown
universe@16 49
universe@16 50 all: setup run-compile teardown
universe@16 51
universe@16 52
universe@16 53 run-compile:
universe@16 54 -${MAKE} compile
universe@16 55
universe@16 56 compile: ${OBJ}
universe@28 57 ${LD} -o ${BIN} ${OBJ} ${LDFLAGS}
universe@1 58
universe@34 59 setup: ${BUILDDIR}
universe@28 60 rm -f ${BUILDDIR}cline.o
universe@34 61 mv ${SRCDIR}cline.h ${SRCDIR}cline.src
universe@34 62 cat ${SRCDIR}cline.src | sed "s/VERSION.*/VERSION=\"${VERSION_PREFIX}$(shell hg identify -n) ($(shell hg identify -i))\";/g" > ${SRCDIR}cline.h
universe@34 63
universe@34 64 ${BUILDDIR}:
universe@34 65 mkdir ${BUILDDIR}
universe@14 66
universe@16 67 teardown:
universe@34 68 rm -f ${SRCDIR}cline.h
universe@34 69 mv ${SRCDIR}cline.src ${SRCDIR}cline.h
universe@14 70
universe@34 71 ${BUILDDIR}%.o: ${SRCDIR}%.c
universe@28 72 ${CC} ${CFLAGS} -c -o ${BUILDDIR}$*.o $<
universe@3 73
universe@3 74 clean:
universe@28 75 rm -f ${BUILDDIR}*.o
universe@16 76

mercurial