Makefile

Wed, 25 Mar 2020 17:14:07 +0100

author
David Demelier <markand@malikania.fr>
date
Wed, 25 Mar 2020 17:14:07 +0100
changeset 13
5c917a8cd011
parent 12
083f11d2536f
child 14
153c09cc6dcb
permissions
-rw-r--r--

make: simplify

#
# Makefile -- basic Makefile for libunicode
#
# Copyright (c) 2013-2020 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

.POSIX:

CC=     cc
CPP=    c++
CFLAGS= -O3 -DNDEBUG

INCS=   -Iextern/libgreatest -I.

.SUFFIXES:
.SUFFIXES: .c

all: unicode.cpp unicode.c

.c:
	${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}

unicode.c: gen/src/mkunicode-c gen/unicode-before.c gen/unicode-after.c
	cat gen/unicode-before.c > unicode.c
	gen/src/mkunicode-c unicode.c gen/UnicodeData.txt
	cat gen/unicode-after.c >> unicode.c

unicode.cpp: gen/src/mkunicode-cpp gen/unicode-before.cpp gen/unicode-after.cpp
	cat gen/unicode-before.cpp > unicode.cpp
	gen/src/mkunicode-cpp unicode.cpp gen/UnicodeData.txt
	cat gen/unicode-after.cpp >> unicode.cpp

test/unicode: unicode.c unicode.h test/unicode.c
	${CC} ${INCS} ${CFLAGS} -o test/unicode unicode.c test/unicode.c ${LDFLAGS}

test/unicode++: unicode.cpp unicode.hpp test/unicode++.cpp
	${CPP} ${INCS} ${CFLAGS} -o test/unicode++ unicode.cpp test/unicode++.cpp ${LDFLAGS}

tests: test/unicode test/unicode++
	test/unicode
	test/unicode++

doxygen:
	doxygen Doxyfile

clean:
	rm -f gen/src/mkunicode-c gen/src/mkunicode-cpp
	rm -f test/unicode test/unicode++

.PHONY: all clean doxygen tests

mercurial