libgrapheme

unicode string library
git clone git://git.suckless.org/libgrapheme
Log | Files | Refs | README | LICENSE

Makefile (17163B)


      1 # See LICENSE file for copyright and license details
      2 # libgrapheme - unicode string library
      3 .POSIX:
      4 .SUFFIXES:
      5 
      6 VERSION_MAJOR = 2
      7 VERSION_MINOR = 0
      8 VERSION_PATCH = 1
      9 UNICODE_VERSION = 15.1.0
     10 MAN_DATE = 2022-10-06
     11 
     12 include config.mk
     13 
     14 VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
     15 
     16 BENCHMARK =\
     17 	benchmark/bidirectional\
     18 	benchmark/case\
     19 	benchmark/character\
     20 	benchmark/sentence\
     21 	benchmark/line\
     22 	benchmark/utf8-decode\
     23 	benchmark/word\
     24 
     25 DATA =\
     26 	data/BidiBrackets.txt\
     27 	data/BidiCharacterTest.txt\
     28 	data/BidiMirroring.txt\
     29 	data/BidiTest.txt\
     30 	data/DerivedBidiClass.txt\
     31 	data/DerivedCoreProperties.txt\
     32 	data/EastAsianWidth.txt\
     33 	data/emoji-data.txt\
     34 	data/GraphemeBreakProperty.txt\
     35 	data/GraphemeBreakTest.txt\
     36 	data/LICENSE\
     37 	data/LineBreak.txt\
     38 	data/LineBreakTest.txt\
     39 	data/SentenceBreakProperty.txt\
     40 	data/SentenceBreakTest.txt\
     41 	data/SpecialCasing.txt\
     42 	data/UnicodeData.txt\
     43 	data/WordBreakProperty.txt\
     44 	data/WordBreakTest.txt\
     45 
     46 GEN =\
     47 	gen/bidirectional\
     48 	gen/bidirectional-test\
     49 	gen/case\
     50 	gen/character\
     51 	gen/character-test\
     52 	gen/line\
     53 	gen/line-test\
     54 	gen/sentence\
     55 	gen/sentence-test\
     56 	gen/word\
     57 	gen/word-test\
     58 
     59 SRC =\
     60 	src/bidirectional\
     61 	src/case\
     62 	src/character\
     63 	src/line\
     64 	src/sentence\
     65 	src/utf8\
     66 	src/util\
     67 	src/word\
     68 
     69 TEST =\
     70 	test/bidirectional\
     71 	test/case\
     72 	test/character\
     73 	test/line\
     74 	test/sentence\
     75 	test/utf8-decode\
     76 	test/utf8-encode\
     77 	test/word\
     78 
     79 MAN_TEMPLATE =\
     80 	man/template/is_case.sh\
     81 	man/template/next_break.sh\
     82 	man/template/to_case.sh\
     83 
     84 MAN3 =\
     85 	man/grapheme_decode_utf8\
     86 	man/grapheme_encode_utf8\
     87 	man/grapheme_is_character_break\
     88 	man/grapheme_is_uppercase\
     89 	man/grapheme_is_uppercase_utf8\
     90 	man/grapheme_is_lowercase\
     91 	man/grapheme_is_lowercase_utf8\
     92 	man/grapheme_is_titlecase\
     93 	man/grapheme_is_titlecase_utf8\
     94 	man/grapheme_next_character_break\
     95 	man/grapheme_next_line_break\
     96 	man/grapheme_next_sentence_break\
     97 	man/grapheme_next_word_break\
     98 	man/grapheme_next_character_break_utf8\
     99 	man/grapheme_next_line_break_utf8\
    100 	man/grapheme_next_sentence_break_utf8\
    101 	man/grapheme_next_word_break_utf8\
    102 	man/grapheme_to_uppercase\
    103 	man/grapheme_to_uppercase_utf8\
    104 	man/grapheme_to_lowercase\
    105 	man/grapheme_to_lowercase_utf8\
    106 	man/grapheme_to_titlecase\
    107 	man/grapheme_to_titlecase_utf8\
    108 
    109 MAN7 =\
    110 	man/libgrapheme\
    111 
    112 all: data/LICENSE $(MAN3:=.3) $(MAN7:=.7) $(ANAME) $(SONAME)
    113 
    114 data/BidiBrackets.txt:
    115 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/BidiBrackets.txt
    116 
    117 data/BidiCharacterTest.txt:
    118 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/BidiCharacterTest.txt
    119 
    120 data/BidiMirroring.txt:
    121 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/BidiMirroring.txt
    122 
    123 data/BidiTest.txt:
    124 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/BidiTest.txt
    125 
    126 data/DerivedBidiClass.txt:
    127 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/extracted/DerivedBidiClass.txt
    128 
    129 data/DerivedCoreProperties.txt:
    130 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/DerivedCoreProperties.txt
    131 
    132 data/EastAsianWidth.txt:
    133 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/EastAsianWidth.txt
    134 
    135 data/emoji-data.txt:
    136 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/emoji/emoji-data.txt
    137 
    138 data/GraphemeBreakProperty.txt:
    139 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/auxiliary/GraphemeBreakProperty.txt
    140 
    141 data/GraphemeBreakTest.txt:
    142 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/auxiliary/GraphemeBreakTest.txt
    143 
    144 data/LICENSE:
    145 	wget -O $@ https://www.unicode.org/license.txt
    146 
    147 data/LineBreak.txt:
    148 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/LineBreak.txt
    149 
    150 data/LineBreakTest.txt:
    151 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/auxiliary/LineBreakTest.txt
    152 
    153 data/SentenceBreakProperty.txt:
    154 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/auxiliary/SentenceBreakProperty.txt
    155 
    156 data/SentenceBreakTest.txt:
    157 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/auxiliary/SentenceBreakTest.txt
    158 
    159 data/SpecialCasing.txt:
    160 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/SpecialCasing.txt
    161 
    162 data/UnicodeData.txt:
    163 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/UnicodeData.txt
    164 
    165 data/WordBreakProperty.txt:
    166 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/auxiliary/WordBreakProperty.txt
    167 
    168 data/WordBreakTest.txt:
    169 	wget -O $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/auxiliary/WordBreakTest.txt
    170 
    171 benchmark/bidirectional.o: benchmark/bidirectional.c Makefile config.mk gen/bidirectional-test.h grapheme.h benchmark/util.h
    172 benchmark/case.o: benchmark/case.c Makefile config.mk gen/word-test.h grapheme.h benchmark/util.h
    173 benchmark/character.o: benchmark/character.c Makefile config.mk gen/character-test.h grapheme.h benchmark/util.h
    174 benchmark/line.o: benchmark/line.c Makefile config.mk gen/line-test.h grapheme.h benchmark/util.h
    175 benchmark/utf8-decode.o: benchmark/utf8-decode.c Makefile config.mk gen/character-test.h grapheme.h benchmark/util.h
    176 benchmark/sentence.o: benchmark/sentence.c Makefile config.mk gen/sentence-test.h grapheme.h benchmark/util.h
    177 benchmark/util.o: benchmark/util.c Makefile config.mk benchmark/util.h
    178 benchmark/word.o: benchmark/word.c Makefile config.mk gen/word-test.h grapheme.h benchmark/util.h
    179 gen/bidirectional.o: gen/bidirectional.c Makefile config.mk gen/util.h
    180 gen/bidirectional-test.o: gen/bidirectional-test.c Makefile config.mk gen/util.h
    181 gen/case.o: gen/case.c Makefile config.mk gen/util.h
    182 gen/character.o: gen/character.c Makefile config.mk gen/util.h
    183 gen/character-test.o: gen/character-test.c Makefile config.mk gen/util.h
    184 gen/line.o: gen/line.c Makefile config.mk gen/util.h
    185 gen/line-test.o: gen/line-test.c Makefile config.mk gen/util.h
    186 gen/sentence.o: gen/sentence.c Makefile config.mk gen/util.h
    187 gen/sentence-test.o: gen/sentence-test.c Makefile config.mk gen/util.h
    188 gen/word.o: gen/word.c Makefile config.mk gen/util.h
    189 gen/word-test.o: gen/word-test.c Makefile config.mk gen/util.h
    190 gen/util.o: gen/util.c Makefile config.mk gen/util.h
    191 src/bidirectional.o: src/bidirectional.c Makefile config.mk gen/bidirectional.h grapheme.h src/util.h
    192 src/case.o: src/case.c Makefile config.mk gen/case.h grapheme.h src/util.h
    193 src/character.o: src/character.c Makefile config.mk gen/character.h grapheme.h src/util.h
    194 src/line.o: src/line.c Makefile config.mk gen/line.h grapheme.h src/util.h
    195 src/sentence.o: src/sentence.c Makefile config.mk gen/sentence.h grapheme.h src/util.h
    196 src/utf8.o: src/utf8.c Makefile config.mk grapheme.h
    197 src/util.o: src/util.c Makefile config.mk gen/types.h grapheme.h src/util.h
    198 src/word.o: src/word.c Makefile config.mk gen/word.h grapheme.h src/util.h
    199 test/bidirectional.o: test/bidirectional.c Makefile config.mk gen/bidirectional.h gen/bidirectional-test.h grapheme.h test/util.h
    200 test/case.o: test/case.c Makefile config.mk grapheme.h test/util.h
    201 test/character.o: test/character.c Makefile config.mk gen/character-test.h grapheme.h test/util.h
    202 test/line.o: test/line.c Makefile config.mk gen/line-test.h grapheme.h test/util.h
    203 test/sentence.o: test/sentence.c Makefile config.mk gen/sentence-test.h grapheme.h test/util.h
    204 test/utf8-encode.o: test/utf8-encode.c Makefile config.mk grapheme.h test/util.h
    205 test/utf8-decode.o: test/utf8-decode.c Makefile config.mk grapheme.h test/util.h
    206 test/util.o: test/util.c Makefile config.mk test/util.h
    207 test/word.o: test/word.c Makefile config.mk gen/word-test.h grapheme.h test/util.h
    208 
    209 benchmark/bidirectional$(BINSUFFIX): benchmark/bidirectional.o benchmark/util.o $(ANAME)
    210 benchmark/case$(BINSUFFIX): benchmark/case.o benchmark/util.o $(ANAME)
    211 benchmark/character$(BINSUFFIX): benchmark/character.o benchmark/util.o $(ANAME)
    212 benchmark/line$(BINSUFFIX): benchmark/line.o benchmark/util.o $(ANAME)
    213 benchmark/sentence$(BINSUFFIX): benchmark/sentence.o benchmark/util.o $(ANAME)
    214 benchmark/utf8-decode$(BINSUFFIX): benchmark/utf8-decode.o benchmark/util.o $(ANAME)
    215 benchmark/word$(BINSUFFIX): benchmark/word.o benchmark/util.o $(ANAME)
    216 gen/bidirectional$(BINSUFFIX): gen/bidirectional.o gen/util.o
    217 gen/bidirectional-test$(BINSUFFIX): gen/bidirectional-test.o gen/util.o
    218 gen/case$(BINSUFFIX): gen/case.o gen/util.o
    219 gen/character$(BINSUFFIX): gen/character.o gen/util.o
    220 gen/character-test$(BINSUFFIX): gen/character-test.o gen/util.o
    221 gen/line$(BINSUFFIX): gen/line.o gen/util.o
    222 gen/line-test$(BINSUFFIX): gen/line-test.o gen/util.o
    223 gen/sentence$(BINSUFFIX): gen/sentence.o gen/util.o
    224 gen/sentence-test$(BINSUFFIX): gen/sentence-test.o gen/util.o
    225 gen/word$(BINSUFFIX): gen/word.o gen/util.o
    226 gen/word-test$(BINSUFFIX): gen/word-test.o gen/util.o
    227 test/bidirectional$(BINSUFFIX): test/bidirectional.o test/util.o $(ANAME)
    228 test/case$(BINSUFFIX): test/case.o test/util.o $(ANAME)
    229 test/character$(BINSUFFIX): test/character.o test/util.o $(ANAME)
    230 test/line$(BINSUFFIX): test/line.o test/util.o $(ANAME)
    231 test/sentence$(BINSUFFIX): test/sentence.o test/util.o $(ANAME)
    232 test/utf8-encode$(BINSUFFIX): test/utf8-encode.o test/util.o $(ANAME)
    233 test/utf8-decode$(BINSUFFIX): test/utf8-decode.o test/util.o $(ANAME)
    234 test/word$(BINSUFFIX): test/word.o test/util.o $(ANAME)
    235 
    236 gen/bidirectional.h: data/BidiBrackets.txt data/BidiMirroring.txt data/DerivedBidiClass.txt data/UnicodeData.txt gen/bidirectional$(BINSUFFIX)
    237 gen/bidirectional-test.h: data/BidiCharacterTest.txt data/BidiTest.txt gen/bidirectional-test$(BINSUFFIX)
    238 gen/case.h: data/DerivedCoreProperties.txt data/UnicodeData.txt data/SpecialCasing.txt gen/case$(BINSUFFIX)
    239 gen/character.h: data/DerivedCoreProperties.txt data/emoji-data.txt data/GraphemeBreakProperty.txt gen/character$(BINSUFFIX)
    240 gen/character-test.h: data/GraphemeBreakTest.txt gen/character-test$(BINSUFFIX)
    241 gen/line.h: data/emoji-data.txt data/EastAsianWidth.txt data/LineBreak.txt gen/line$(BINSUFFIX)
    242 gen/line-test.h: data/LineBreakTest.txt gen/line-test$(BINSUFFIX)
    243 gen/sentence.h: data/SentenceBreakProperty.txt gen/sentence$(BINSUFFIX)
    244 gen/sentence-test.h: data/SentenceBreakTest.txt gen/sentence-test$(BINSUFFIX)
    245 gen/word.h: data/WordBreakProperty.txt gen/word$(BINSUFFIX)
    246 gen/word-test.h: data/WordBreakTest.txt gen/word-test$(BINSUFFIX)
    247 
    248 man/grapheme_is_character_break.3: man/grapheme_is_character_break.sh Makefile config.mk
    249 man/grapheme_is_uppercase.3: man/grapheme_is_uppercase.sh man/template/is_case.sh Makefile config.mk
    250 man/grapheme_is_uppercase_utf8.3: man/grapheme_is_uppercase_utf8.sh man/template/is_case.sh Makefile config.mk
    251 man/grapheme_is_lowercase.3: man/grapheme_is_lowercase.sh man/template/is_case.sh Makefile config.mk
    252 man/grapheme_is_lowercase_utf8.3: man/grapheme_is_lowercase_utf8.sh man/template/is_case.sh Makefile config.mk
    253 man/grapheme_is_titlecase.3: man/grapheme_is_titlecase.sh man/template/is_case.sh Makefile config.mk
    254 man/grapheme_is_titlecase_utf8.3: man/grapheme_is_titlecase_utf8.sh man/template/is_case.sh Makefile config.mk
    255 man/grapheme_next_character_break.3: man/grapheme_next_character_break.sh man/template/next_break.sh Makefile config.mk
    256 man/grapheme_next_line_break.3: man/grapheme_next_line_break.sh man/template/next_break.sh Makefile config.mk
    257 man/grapheme_next_sentence_break.3: man/grapheme_next_sentence_break.sh man/template/next_break.sh Makefile config.mk
    258 man/grapheme_next_word_break.3: man/grapheme_next_word_break.sh man/template/next_break.sh Makefile config.mk
    259 man/grapheme_next_character_break_utf8.3: man/grapheme_next_character_break_utf8.sh man/template/next_break.sh Makefile config.mk
    260 man/grapheme_next_line_break_utf8.3: man/grapheme_next_line_break_utf8.sh man/template/next_break.sh Makefile config.mk
    261 man/grapheme_next_sentence_break_utf8.3: man/grapheme_next_sentence_break_utf8.sh man/template/next_break.sh Makefile config.mk
    262 man/grapheme_next_word_break_utf8.3: man/grapheme_next_word_break_utf8.sh man/template/next_break.sh Makefile config.mk
    263 man/grapheme_to_uppercase.3: man/grapheme_to_uppercase.sh man/template/to_case.sh Makefile config.mk
    264 man/grapheme_to_lowercase.3: man/grapheme_to_lowercase.sh man/template/to_case.sh Makefile config.mk
    265 man/grapheme_to_titlecase.3: man/grapheme_to_titlecase.sh man/template/to_case.sh Makefile config.mk
    266 man/grapheme_to_uppercase_utf8.3: man/grapheme_to_uppercase_utf8.sh man/template/to_case.sh Makefile config.mk
    267 man/grapheme_to_lowercase_utf8.3: man/grapheme_to_lowercase_utf8.sh man/template/to_case.sh Makefile config.mk
    268 man/grapheme_to_titlecase_utf8.3: man/grapheme_to_titlecase_utf8.sh man/template/to_case.sh Makefile config.mk
    269 man/grapheme_decode_utf8.3: man/grapheme_decode_utf8.sh Makefile config.mk
    270 man/grapheme_encode_utf8.3: man/grapheme_encode_utf8.sh Makefile config.mk
    271 
    272 man/libgrapheme.7: man/libgrapheme.sh Makefile config.mk
    273 
    274 $(GEN:=.o) gen/util.o:
    275 	$(BUILD_CC) -c -o $@ $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) $(@:.o=.c)
    276 
    277 $(BENCHMARK:=.o) benchmark/util.o $(TEST:=.o) test/util.o:
    278 	$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(@:.o=.c)
    279 
    280 $(SRC:=.o):
    281 	$(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(SHFLAGS) $(@:.o=.c)
    282 
    283 $(BENCHMARK:=$(BINSUFFIX)):
    284 	$(CC) -o $@ $(LDFLAGS) $(@:$(BINSUFFIX)=.o) benchmark/util.o $(ANAME) -lutf8proc
    285 
    286 $(GEN:=$(BINSUFFIX)):
    287 	$(BUILD_CC) -o $@ $(BUILD_LDFLAGS) $(@:$(BINSUFFIX)=.o) gen/util.o
    288 
    289 $(TEST:=$(BINSUFFIX)):
    290 	$(CC) -o $@ $(LDFLAGS) $(@:$(BINSUFFIX)=.o) test/util.o $(ANAME)
    291 
    292 $(GEN:=.h):
    293 	$(@:.h=$(BINSUFFIX)) > $@
    294 
    295 $(ANAME): $(SRC:=.o)
    296 	$(AR) -rc $@ $?
    297 	$(RANLIB) $@
    298 
    299 $(SONAME): $(SRC:=.o)
    300 	$(CC) -o $@ $(SOFLAGS) $(LDFLAGS) $(SRC:=.o)
    301 
    302 $(MAN3:=.3):
    303 	SH="$(SH)" MAN_DATE="$(MAN_DATE)" UNICODE_VERSION="$(UNICODE_VERSION)" $(SH) $(@:.3=.sh) > $@
    304 
    305 $(MAN7:=.7):
    306 	SH="$(SH)" MAN_DATE="$(MAN_DATE)" UNICODE_VERSION="$(UNICODE_VERSION)" $(SH) $(@:.7=.sh) > $@
    307 
    308 benchmark: $(BENCHMARK:=$(BINSUFFIX))
    309 	for m in $(BENCHMARK:=$(BINSUFFIX)); do ./$$m; done
    310 
    311 check: test
    312 
    313 test: $(TEST:=$(BINSUFFIX))
    314 	for m in $(TEST:=$(BINSUFFIX)); do ./$$m; done
    315 
    316 install: all
    317 	mkdir -p "$(DESTDIR)$(LIBPREFIX)"
    318 	mkdir -p "$(DESTDIR)$(INCPREFIX)"
    319 	mkdir -p "$(DESTDIR)$(MANPREFIX)/man3"
    320 	mkdir -p "$(DESTDIR)$(MANPREFIX)/man7"
    321 	cp -f $(MAN3:=.3) "$(DESTDIR)$(MANPREFIX)/man3"
    322 	cp -f $(MAN7:=.7) "$(DESTDIR)$(MANPREFIX)/man7"
    323 	cp -f $(ANAME) "$(DESTDIR)$(LIBPREFIX)"
    324 	cp -f $(SONAME) "$(DESTDIR)$(LIBPREFIX)/$(SONAME)"
    325 	if [ "$(SOSYMLINK)" = "true" ]; then i=0; while [ "$$i" -le $(VERSION_MINOR) ]; do ln -sf "$(SONAME)" "$(DESTDIR)$(LIBPREFIX)/libgrapheme.so.$(VERSION_MAJOR).$$i"; i=$$((i+1)); done; fi
    326 	if [ "$(SOSYMLINK)" = "true" ]; then ln -sf "$(SONAME)" "$(DESTDIR)$(LIBPREFIX)/libgrapheme.so.$(VERSION_MAJOR)"; fi
    327 	if [ "$(SOSYMLINK)" = "true" ]; then ln -sf "$(SONAME)" "$(DESTDIR)$(LIBPREFIX)/libgrapheme.so"; fi
    328 	cp -f grapheme.h "$(DESTDIR)$(INCPREFIX)"
    329 	if ! [ -z "$(LDCONFIG)" ]; then $(SHELL) -c "$(LDCONFIG)"; fi
    330 	if ! [ -z "$(PCPREFIX)" ]; then mkdir -p "$(DESTDIR)$(PCPREFIX)"; printf "Name: libgrapheme\nDescription: Unicode string library\nURL: https://libs.suckless.org/libgrapheme/\nVersion: $(VERSION)\nCflags: -I$(INCPREFIX)\nLibs: -L$(LIBPREFIX) -lgrapheme\n" > "$(DESTDIR)$(PCPREFIX)/libgrapheme.pc"; fi
    331 
    332 uninstall:
    333 	for m in $(MAN3:=.3); do rm -f "$(DESTDIR)$(MANPREFIX)/man3/`basename $$m`"; done
    334 	for m in $(MAN7:=.7); do rm -f "$(DESTDIR)$(MANPREFIX)/man7/`basename $$m`"; done
    335 	rm -f "$(DESTDIR)$(LIBPREFIX)/$(ANAME)"
    336 	rm -f "$(DESTDIR)$(LIBPREFIX)/$(SONAME)"
    337 	if [ "$(SOSYMLINK)" = "true" ]; then i=0; while [ "$$i" -le $(VERSION_MINOR) ]; do rm -f "$(DESTDIR)$(LIBPREFIX)/libgrapheme.so.$(VERSION_MAJOR).$$i"; i=$$((i+1)); done; fi
    338 	if [ "$(SOSYMLINK)" = "true" ]; then rm -f "$(DESTDIR)$(LIBPREFIX)/libgrapheme.so.$(VERSION_MAJOR)"; fi
    339 	if [ "$(SOSYMLINK)" = "true" ]; then rm -f "$(DESTDIR)$(LIBPREFIX)/libgrapheme.so"; fi
    340 	rm -f "$(DESTDIR)$(INCPREFIX)/grapheme.h"
    341 	if ! [ -z "$(LDCONFIG)" ]; then $(SHELL) -c "$(LDCONFIG)"; fi
    342 	if ! [ -z "$(PCPREFIX)" ]; then rm -f "$(DESTDIR)$(PCPREFIX)/libgrapheme.pc"; fi
    343 
    344 clean:
    345 	rm -f $(BENCHMARK:=.o) benchmark/util.o $(BENCHMARK:=$(BINSUFFIX)) $(GEN:=.h) $(GEN:=.o) gen/util.o $(GEN:=$(BINSUFFIX)) $(SRC:=.o) src/util.o $(TEST:=.o) test/util.o $(TEST:=$(BINSUFFIX)) $(ANAME) $(SONAME) $(MAN3:=.3) $(MAN7:=.7)
    346 
    347 clean-data:
    348 	rm -f $(DATA)
    349 
    350 dist:
    351 	rm -rf "libgrapheme-$(VERSION)"
    352 	mkdir "libgrapheme-$(VERSION)"
    353 	for m in benchmark data gen man man/template src test; do mkdir "libgrapheme-$(VERSION)/$$m"; done
    354 	cp config.mk configure grapheme.h LICENSE Makefile README "libgrapheme-$(VERSION)"
    355 	cp $(BENCHMARK:=.c) benchmark/util.c benchmark/util.h "libgrapheme-$(VERSION)/benchmark"
    356 	cp $(DATA) "libgrapheme-$(VERSION)/data"
    357 	cp $(GEN:=.c) gen/util.c gen/types.h gen/util.h "libgrapheme-$(VERSION)/gen"
    358 	cp $(MAN3:=.sh) $(MAN7:=.sh) "libgrapheme-$(VERSION)/man"
    359 	cp $(MAN_TEMPLATE) "libgrapheme-$(VERSION)/man/template"
    360 	cp $(SRC:=.c) src/util.h "libgrapheme-$(VERSION)/src"
    361 	cp $(TEST:=.c) test/util.c test/util.h "libgrapheme-$(VERSION)/test"
    362 	tar -cf - "libgrapheme-$(VERSION)" | gzip -c > "libgrapheme-$(VERSION).tar.gz"
    363 	rm -rf "libgrapheme-$(VERSION)"
    364 
    365 format:
    366 	clang-format -i grapheme.h $(BENCHMARK:=.c) benchmark/util.c benchmark/util.h $(GEN:=.c) gen/util.c gen/types.h gen/util.h $(SRC:=.c) src/util.h $(TEST:=.c) test/util.c test/util.h
    367 
    368 .PHONY: all benchmark check clean clean-data dist format install test uninstall