make: simplify

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

make: simplify

.hgignore file | annotate | diff | comparison | revisions
Makefile file | annotate | diff | comparison | revisions
--- a/.hgignore	Wed Mar 25 17:03:18 2020 +0100
+++ b/.hgignore	Wed Mar 25 17:14:07 2020 +0100
@@ -7,8 +7,8 @@
 ^doxygen/
 
 # Generator files.
-^gen/mkunicode-c$
-^gen/mkunicode-cpp$
+^gen/src/mkunicode-c$
+^gen/src/mkunicode-cpp$
 
 # Test files.
 ^test/unicode$
--- a/Makefile	Wed Mar 25 17:03:18 2020 +0100
+++ b/Makefile	Wed Mar 25 17:14:07 2020 +0100
@@ -22,41 +22,41 @@
 CPP=    c++
 CFLAGS= -O3 -DNDEBUG
 
+INCS=   -Iextern/libgreatest -I.
+
 .SUFFIXES:
-.SUFFIXES: .c .cpp
+.SUFFIXES: .c
 
 all: unicode.cpp unicode.c
 
 .c:
-	${CC} ${CFLAGS} -Iextern/libgreatest -I. $< unicode.c -o $@ ${LDFLAGS}
-
-.cpp:
-	${CPP} ${CFLAGS} -Iextern/libgreatest -I. $< unicode.cpp -o $@ ${LDFLAGS}
+	${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
 
-gen/mkunicode-c: gen/src/mkunicode-c.c
-	${CC} ${CFLAGS} -o $@ gen/src/mkunicode-c.c ${LDFLAGS}
-
-gen/mkunicode-cpp: gen/src/mkunicode-cpp.c
-	${CC} ${CFLAGS} -o $@ gen/src/mkunicode-cpp.c ${LDFLAGS}
-
-unicode.c: gen/mkunicode-c gen/unicode-before.c gen/unicode-after.c
+unicode.c: gen/src/mkunicode-c gen/unicode-before.c gen/unicode-after.c
 	cat gen/unicode-before.c > unicode.c
-	gen/mkunicode-c unicode.c gen/UnicodeData.txt
+	gen/src/mkunicode-c unicode.c gen/UnicodeData.txt
 	cat gen/unicode-after.c >> unicode.c
 
-unicode.cpp: gen/mkunicode-cpp gen/unicode-before.cpp gen/unicode-after.cpp
+unicode.cpp: gen/src/mkunicode-cpp gen/unicode-before.cpp gen/unicode-after.cpp
 	cat gen/unicode-before.cpp > unicode.cpp
-	gen/mkunicode-cpp unicode.cpp gen/UnicodeData.txt
+	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/mkunicode-c gen/mkunicode-cpp
+	rm -f gen/src/mkunicode-c gen/src/mkunicode-cpp
 	rm -f test/unicode test/unicode++
 
 .PHONY: all clean doxygen tests

mercurial