universe@28: # universe@28: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. universe@28: # universe@28: # Copyright 2011 Mike Becker. All rights reserved. universe@28: # universe@28: # Redistribution and use in source and binary forms, with or without universe@28: # modification, are permitted provided that the following conditions are met: universe@28: # universe@28: # 1. Redistributions of source code must retain the above copyright universe@28: # notice, this list of conditions and the following disclaimer. universe@28: # universe@28: # 2. Redistributions in binary form must reproduce the above copyright universe@28: # notice, this list of conditions and the following disclaimer in the universe@28: # documentation and/or other materials provided with the distribution. universe@28: # universe@28: # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" universe@28: # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE universe@28: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE universe@28: # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE universe@28: # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL universe@28: # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR universe@28: # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER universe@28: # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, universe@28: # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE universe@28: # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. universe@28: # universe@28: # available configurations: universe@28: # gcc (default) (will use libc regex implicitly) universe@28: # mingw (will use libregex as static lib) universe@28: # universe@28: # debug configurations: universe@28: # gcc-debug universe@28: # mingw-debug universe@28: # universe@28: universe@28: #ifndef CONF universe@28: CONF = gcc universe@28: #endif universe@28: universe@32: VERSION_PREFIX=1.0. universe@34: SRCDIR=src/ universe@34: BUILDDIR=build/ universe@34: OBJ = $(shell ls ${SRCDIR} | grep '\.c' | sed 's/^\([^.]*\)\.c$$/${BUILDDIR:/=\/}\1.o/g' | tr '\n' ' ') universe@34: BIN = ${BUILDDIR}cline universe@32: universe@28: include ${CONF}.mk universe@0: universe@16: .PHONY: setup run-compile teardown universe@16: universe@16: all: setup run-compile teardown universe@16: universe@16: universe@16: run-compile: universe@16: -${MAKE} compile universe@16: universe@16: compile: ${OBJ} universe@28: ${LD} -o ${BIN} ${OBJ} ${LDFLAGS} universe@1: universe@34: setup: ${BUILDDIR} universe@28: rm -f ${BUILDDIR}cline.o universe@34: mv ${SRCDIR}cline.h ${SRCDIR}cline.src universe@34: cat ${SRCDIR}cline.src | sed "s/VERSION.*/VERSION=\"${VERSION_PREFIX}$(shell hg identify -n) ($(shell hg identify -i))\";/g" > ${SRCDIR}cline.h universe@34: universe@34: ${BUILDDIR}: universe@34: mkdir ${BUILDDIR} universe@14: universe@16: teardown: universe@34: rm -f ${SRCDIR}cline.h universe@34: mv ${SRCDIR}cline.src ${SRCDIR}cline.h universe@14: universe@34: ${BUILDDIR}%.o: ${SRCDIR}%.c universe@28: ${CC} ${CFLAGS} -c -o ${BUILDDIR}$*.o $< universe@3: universe@3: clean: universe@28: rm -f ${BUILDDIR}*.o universe@16: