utf8proc

annotate 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
rev   line source
jbe@0 1 # libutf8proc Makefile
jbe@0 2
Jiahao@15 3 CURL=curl
Jiahao@15 4 RUBY=ruby
Jiahao@15 5 MAKE=make
jbe@0 6
jbe@0 7 # settings
jbe@0 8
Jiahao@15 9 cflags = -O2 -std=c99 -pedantic -Wall -fpic -DUTF8PROC_EXPORTS $(CFLAGS)
jbe@9 10 cc = $(CC) $(cflags)
Jiahao@15 11 AR = ar
jbe@0 12
Jiahao@15 13 OS := $(shell uname)
Jiahao@15 14 ifeq ($(OS),Darwin)
Jiahao@15 15 SHLIB_EXT = dylib
Jiahao@15 16 else #TODO Windows
Jiahao@15 17 SHLIB_EXT = so
Jiahao@15 18 endif
jbe@0 19
jbe@0 20 # meta targets
jbe@0 21
jbe@0 22 c-library: libutf8proc.a libutf8proc.so
jbe@0 23
jbe@0 24 ruby-library: ruby/utf8proc_native.so
jbe@0 25
jbe@0 26 pgsql-library: pgsql/utf8proc_pgsql.so
jbe@0 27
jbe@10 28 all: c-library ruby-library ruby-gem pgsql-library
jbe@0 29
jbe@0 30 clean::
Jiahao@15 31 rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_EXT) normtest UnicodeData.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt NormalizationTest.txt
jbe@0 32 cd ruby/ && test -e Makefile && (make clean && rm -f Makefile) || true
jbe@10 33 rm -Rf ruby/gem/lib ruby/gem/ext
jbe@10 34 rm -f ruby/gem/utf8proc-*.gem
jbe@0 35 cd pgsql/ && make clean
jbe@0 36
Jiahao@15 37 update: utf8proc_data.c.new
Jiahao@15 38
jbe@0 39 # real targets
jbe@0 40
Jiahao@15 41 utf8proc_data.c.new: UnicodeData.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt
Jiahao@15 42 $(RUBY) data_generator.rb < UnicodeData.txt > utf8proc_data.c.new
Jiahao@15 43
Jiahao@15 44 UnicodeData.txt:
Jiahao@15 45
Jiahao@15 46 $(CURL) -O http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
Jiahao@15 47
Jiahao@15 48 DerivedCoreProperties.txt:
Jiahao@15 49 $(CURL) -O http://www.unicode.org/Public/UNIDATA/DerivedCoreProperties.txt
Jiahao@15 50
Jiahao@15 51 CompositionExclusions.txt:
Jiahao@15 52 $(CURL) -O http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt
Jiahao@15 53
Jiahao@15 54 CaseFolding.txt:
Jiahao@15 55 $(CURL) -O http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
Jiahao@15 56
jbe@0 57 utf8proc.o: utf8proc.h utf8proc.c utf8proc_data.c
jbe@0 58 $(cc) -c -o utf8proc.o utf8proc.c
jbe@0 59
jbe@0 60 libutf8proc.a: utf8proc.o
jbe@0 61 rm -f libutf8proc.a
Jiahao@15 62 $(AR) rs libutf8proc.a utf8proc.o
jbe@0 63
jbe@0 64 libutf8proc.so: utf8proc.o
Jiahao@15 65 $(cc) -shared -o libutf8proc.$(SHLIB_EXT) utf8proc.o
Jiahao@15 66 chmod a-x libutf8proc.$(SHLIB_EXT)
jbe@0 67
jbe@9 68 libutf8proc.dylib: utf8proc.o
jbe@9 69 $(cc) -dynamiclib -o $@ $^ -install_name $(libdir)/$@
jbe@9 70
jbe@0 71 ruby/Makefile: ruby/extconf.rb
jbe@0 72 cd ruby && ruby extconf.rb
jbe@0 73
jbe@0 74 ruby/utf8proc_native.so: utf8proc.h utf8proc.c utf8proc_data.c \
jbe@0 75 ruby/utf8proc_native.c ruby/Makefile
jbe@0 76 cd ruby && make
jbe@0 77
jbe@10 78 ruby/gem/lib/utf8proc.rb: ruby/utf8proc.rb
jbe@10 79 test -e ruby/gem/lib || mkdir ruby/gem/lib
jbe@10 80 cp ruby/utf8proc.rb ruby/gem/lib/
jbe@10 81
jbe@10 82 ruby/gem/ext/extconf.rb: ruby/extconf.rb
jbe@10 83 test -e ruby/gem/ext || mkdir ruby/gem/ext
jbe@10 84 cp ruby/extconf.rb ruby/gem/ext/
jbe@10 85
jbe@10 86 ruby/gem/ext/utf8proc_native.c: utf8proc.h utf8proc_data.c utf8proc.c ruby/utf8proc_native.c
jbe@10 87 test -e ruby/gem/ext || mkdir ruby/gem/ext
jbe@10 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
jbe@10 89
jbe@10 90 ruby-gem:: ruby/gem/lib/utf8proc.rb ruby/gem/ext/extconf.rb ruby/gem/ext/utf8proc_native.c
jbe@10 91 cd ruby/gem && gem build utf8proc.gemspec
jbe@10 92
jbe@0 93 pgsql/utf8proc_pgsql.so: utf8proc.h utf8proc.c utf8proc_data.c \
jbe@0 94 pgsql/utf8proc_pgsql.c
jbe@0 95 cd pgsql && make
jbe@0 96
Jiahao@15 97
Jiahao@15 98 # Test programs
Jiahao@15 99
Jiahao@15 100 NormalizationTest.txt:
Jiahao@15 101 $(CURL) -O http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt
Jiahao@15 102
Jiahao@15 103 normtest: normtest.c utf8proc.o utf8proc.h
Jiahao@15 104 $(cc) normtest.c utf8proc.o -o normtest
Jiahao@15 105
Jiahao@15 106 check: normtest NormalizationTest.txt
Jiahao@15 107 ./normtest

Impressum / About Us