utf8proc

view Makefile @ 17:47b467f4c128

Contribution from libmojibake fork (missing file "normtest.c")
author Jiahao Chen, Steven G. Johnson, Anthony David Kelman
date Mon Dec 01 14:32:19 2014 -0500 (2014-12-01)
parents 15450ff3d454
children
line source
1 # libutf8proc Makefile
3 CURL=curl
4 RUBY=ruby
5 MAKE=make
7 # settings
9 cflags = -O2 -std=c99 -pedantic -Wall -fpic -DUTF8PROC_EXPORTS $(CFLAGS)
10 cc = $(CC) $(cflags)
11 AR = ar
13 OS := $(shell uname)
14 ifeq ($(OS),Darwin)
15 SHLIB_EXT = dylib
16 else #TODO Windows
17 SHLIB_EXT = so
18 endif
20 # meta targets
22 c-library: libutf8proc.a libutf8proc.so
24 ruby-library: ruby/utf8proc_native.so
26 pgsql-library: pgsql/utf8proc_pgsql.so
28 all: c-library ruby-library ruby-gem pgsql-library
30 clean::
31 rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_EXT) normtest UnicodeData.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt NormalizationTest.txt
32 cd ruby/ && test -e Makefile && (make clean && rm -f Makefile) || true
33 rm -Rf ruby/gem/lib ruby/gem/ext
34 rm -f ruby/gem/utf8proc-*.gem
35 cd pgsql/ && make clean
37 update: utf8proc_data.c.new
39 # real targets
41 utf8proc_data.c.new: UnicodeData.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt
42 $(RUBY) data_generator.rb < UnicodeData.txt > utf8proc_data.c.new
44 UnicodeData.txt:
46 $(CURL) -O http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
48 DerivedCoreProperties.txt:
49 $(CURL) -O http://www.unicode.org/Public/UNIDATA/DerivedCoreProperties.txt
51 CompositionExclusions.txt:
52 $(CURL) -O http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt
54 CaseFolding.txt:
55 $(CURL) -O http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
57 utf8proc.o: utf8proc.h utf8proc.c utf8proc_data.c
58 $(cc) -c -o utf8proc.o utf8proc.c
60 libutf8proc.a: utf8proc.o
61 rm -f libutf8proc.a
62 $(AR) rs libutf8proc.a utf8proc.o
64 libutf8proc.so: utf8proc.o
65 $(cc) -shared -o libutf8proc.$(SHLIB_EXT) utf8proc.o
66 chmod a-x libutf8proc.$(SHLIB_EXT)
68 libutf8proc.dylib: utf8proc.o
69 $(cc) -dynamiclib -o $@ $^ -install_name $(libdir)/$@
71 ruby/Makefile: ruby/extconf.rb
72 cd ruby && ruby extconf.rb
74 ruby/utf8proc_native.so: utf8proc.h utf8proc.c utf8proc_data.c \
75 ruby/utf8proc_native.c ruby/Makefile
76 cd ruby && make
78 ruby/gem/lib/utf8proc.rb: ruby/utf8proc.rb
79 test -e ruby/gem/lib || mkdir ruby/gem/lib
80 cp ruby/utf8proc.rb ruby/gem/lib/
82 ruby/gem/ext/extconf.rb: ruby/extconf.rb
83 test -e ruby/gem/ext || mkdir ruby/gem/ext
84 cp ruby/extconf.rb ruby/gem/ext/
86 ruby/gem/ext/utf8proc_native.c: utf8proc.h utf8proc_data.c utf8proc.c ruby/utf8proc_native.c
87 test -e ruby/gem/ext || mkdir ruby/gem/ext
88 cat utf8proc.h utf8proc_data.c utf8proc.c ruby/utf8proc_native.c | grep -v '#include "utf8proc.h"' | grep -v '#include "utf8proc_data.c"' | grep -v '#include "../utf8proc.c"' > ruby/gem/ext/utf8proc_native.c
90 ruby-gem:: ruby/gem/lib/utf8proc.rb ruby/gem/ext/extconf.rb ruby/gem/ext/utf8proc_native.c
91 cd ruby/gem && gem build utf8proc.gemspec
93 pgsql/utf8proc_pgsql.so: utf8proc.h utf8proc.c utf8proc_data.c \
94 pgsql/utf8proc_pgsql.c
95 cd pgsql && make
98 # Test programs
100 NormalizationTest.txt:
101 $(CURL) -O http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt
103 normtest: normtest.c utf8proc.o utf8proc.h
104 $(cc) normtest.c utf8proc.o -o normtest
106 check: normtest NormalizationTest.txt
107 ./normtest

Impressum / About Us