@@ -5,6 +5,7 @@ MAKE=make
55AR? =ar
66CC? =gcc
77INSTALL =install
8+ FIND =find
89
910# compiler settings
1011CFLAGS ?= -O2
@@ -17,7 +18,7 @@ UCFLAGS = $(CFLAGS) $(PICFLAG) $(C99FLAG) $(WCFLAGS) -DUTF8PROC_EXPORTS
1718# from the utf8proc version number because it indicates ABI compatibility,
1819# not API compatibility: MAJOR should be incremented whenever *binary*
1920# compatibility is broken, even if the API is backward-compatible
20- # Be sure to also update these in CMakeLists.txt!
21+ # Be sure to also update these in MANIFEST and CMakeLists.txt!
2122MAJOR =1
2223MINOR =3
2324PATCH =0
@@ -38,12 +39,17 @@ includedir=$(prefix)/include
3839
3940# meta targets
4041
41- .PHONY : all, clean, update, data
42+ .PHONY : all clean data update manifest install
4243
4344all : libutf8proc.a libutf8proc.$(SHLIB_EXT )
4445
4546clean :
46- rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_VERS_EXT ) libutf8proc.$(SHLIB_EXT ) test/normtest test/graphemetest test/printproperty test/charwidth test/valid test/iterate
47+ rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_VERS_EXT ) libutf8proc.$(SHLIB_EXT )
48+ ifneq ($(OS ) ,Darwin)
49+ rm -f libutf8proc.so.$(MAJOR)
50+ endif
51+ rm -f test/tests.o test/normtest test/graphemetest test/printproperty test/charwidth test/valid test/iterate test/case
52+ rm -rf MANIFEST.new tmp
4753 $(MAKE) -C bench clean
4854 $(MAKE) -C data clean
4955
@@ -52,6 +58,8 @@ data: data/utf8proc_data.c.new
5258update : data/utf8proc_data.c.new
5359 cp -f data/utf8proc_data.c.new utf8proc_data.c
5460
61+ manifest : MANIFEST.new
62+
5563# real targets
5664
5765data/utf8proc_data.c.new : libutf8proc.$(SHLIB_EXT ) data/data_generator.rb data/charwidths.jl
@@ -84,12 +92,17 @@ install: libutf8proc.a libutf8proc.$(SHLIB_EXT) libutf8proc.$(SHLIB_VERS_EXT)
8492 mkdir -m 755 -p $(DESTDIR )$(libdir )
8593 $(INSTALL ) -m 644 libutf8proc.a $(DESTDIR )$(libdir )
8694 $(INSTALL ) -m 755 libutf8proc.$(SHLIB_VERS_EXT ) $(DESTDIR )$(libdir )
87- ln -f -s $( libdir ) / libutf8proc.$(SHLIB_VERS_EXT ) $(DESTDIR )$(libdir ) /libutf8proc.$(SHLIB_EXT )
95+ ln -f -s libutf8proc.$(SHLIB_VERS_EXT ) $(DESTDIR )$(libdir ) /libutf8proc.$(SHLIB_EXT )
8896ifneq ($(OS ) ,Darwin)
89- ln -f -s $(libdir)/libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)/libutf8proc.so.$(MAJOR)
90- ln -f -s $(libdir)/libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)/libutf8proc.so.$(MAJOR).$(MINOR)
97+ ln -f -s libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)/libutf8proc.so.$(MAJOR)
9198endif
9299
100+ MANIFEST.new :
101+ rm -rf tmp
102+ $(MAKE ) install prefix=/usr DESTDIR=$(PWD ) /tmp
103+ $(FIND ) tmp/usr -mindepth 1 -type l -printf " %P -> %l\n" -or -type f -printf " %P\n" -or -type d -printf " %P/\n" | LC_ALL=C sort > $@
104+ rm -rf tmp
105+
93106# Test programs
94107
95108data/NormalizationTest.txt :
@@ -98,26 +111,29 @@ data/NormalizationTest.txt:
98111data/GraphemeBreakTest.txt :
99112 $(MAKE ) -C data GraphemeBreakTest.txt
100113
101- test/normtest : test/normtest.c utf8proc.o utf8proc.h test/tests.h
102- $(CC ) $(UCFLAGS ) test/normtest.c utf8proc.o -o $@
114+ test/tests.o : test/tests.c test/tests.h utf8proc.h
115+ $(CC ) $(UCFLAGS ) -c -o test/tests.o test/tests.c
116+
117+ test/normtest : test/normtest.c test/tests.o utf8proc.o utf8proc.h test/tests.h
118+ $(CC ) $(UCFLAGS ) test/normtest.c test/tests.o utf8proc.o -o $@
103119
104- test/graphemetest : test/graphemetest.c utf8proc.o utf8proc.h test/tests.h
105- $(CC ) $(UCFLAGS ) test/graphemetest.c utf8proc.o -o $@
120+ test/graphemetest : test/graphemetest.c test/tests.o utf8proc.o utf8proc.h test/tests.h
121+ $(CC ) $(UCFLAGS ) test/graphemetest.c test/tests.o utf8proc.o -o $@
106122
107- test/printproperty : test/printproperty.c utf8proc.o utf8proc.h test/tests.h
108- $(CC ) $(UCFLAGS ) test/printproperty.c utf8proc.o -o $@
123+ test/printproperty : test/printproperty.c test/tests.o utf8proc.o utf8proc.h test/tests.h
124+ $(CC ) $(UCFLAGS ) test/printproperty.c test/tests.o utf8proc.o -o $@
109125
110- test/charwidth : test/charwidth.c utf8proc.o utf8proc.h test/tests.h
111- $(CC ) $(UCFLAGS ) test/charwidth.c utf8proc.o -o $@
126+ test/charwidth : test/charwidth.c test/tests.o utf8proc.o utf8proc.h test/tests.h
127+ $(CC ) $(UCFLAGS ) test/charwidth.c test/tests.o utf8proc.o -o $@
112128
113- test/valid : test/valid.c utf8proc.o utf8proc.h test/tests.h
114- $(CC ) $(UCFLAGS ) test/valid.c utf8proc.o -o $@
129+ test/valid : test/valid.c test/tests.o utf8proc.o utf8proc.h test/tests.h
130+ $(CC ) $(UCFLAGS ) test/valid.c test/tests.o utf8proc.o -o $@
115131
116- test/iterate : test/iterate.c utf8proc.o utf8proc.h test/tests.h
117- $(CC ) $(UCFLAGS ) test/iterate.c utf8proc.o -o $@
132+ test/iterate : test/iterate.c test/tests.o utf8proc.o utf8proc.h test/tests.h
133+ $(CC ) $(UCFLAGS ) test/iterate.c test/tests.o utf8proc.o -o $@
118134
119- test/case : test/case.c utf8proc.o utf8proc.h test/tests.h
120- $(CC ) $(UCFLAGS ) test/case.c utf8proc.o -o $@
135+ test/case : test/case.c test/tests.o utf8proc.o utf8proc.h test/tests.h
136+ $(CC ) $(UCFLAGS ) test/case.c test/tests.o utf8proc.o -o $@
121137
122138check : test/normtest data/NormalizationTest.txt test/graphemetest data/GraphemeBreakTest.txt test/printproperty test/case test/charwidth test/valid test/iterate bench/bench.c bench/util.c bench/util.h utf8proc.o
123139 $(MAKE ) -C bench
0 commit comments