utf8proc

diff Makefile @ 15:15450ff3d454

Contribution from libmojibake fork
author Jiahao Chen, Steven G. Johnson, Anthony David Kelman
date Fri Nov 21 08:27:44 2014 -0500 (2014-11-21)
parents 00d2bcbdc945
children
line diff
     1.1 --- a/Makefile	Wed Nov 27 12:00:00 2013 +0100
     1.2 +++ b/Makefile	Fri Nov 21 08:27:44 2014 -0500
     1.3 @@ -1,11 +1,21 @@
     1.4  # libutf8proc Makefile
     1.5  
     1.6 +CURL=curl
     1.7 +RUBY=ruby
     1.8 +MAKE=make
     1.9  
    1.10  # settings
    1.11  
    1.12 -cflags = -O2 -std=c99 -pedantic -Wall -fpic $(CFLAGS)
    1.13 +cflags = -O2 -std=c99 -pedantic -Wall -fpic -DUTF8PROC_EXPORTS $(CFLAGS)
    1.14  cc = $(CC) $(cflags)
    1.15 +AR = ar
    1.16  
    1.17 +OS := $(shell uname)
    1.18 +ifeq ($(OS),Darwin)
    1.19 +	SHLIB_EXT = dylib
    1.20 +else #TODO Windows
    1.21 +	SHLIB_EXT = so
    1.22 +endif
    1.23  
    1.24  # meta targets
    1.25  
    1.26 @@ -18,24 +28,42 @@
    1.27  all: c-library ruby-library ruby-gem pgsql-library
    1.28  
    1.29  clean::
    1.30 -	rm -f utf8proc.o libutf8proc.a libutf8proc.so
    1.31 +	rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_EXT) normtest UnicodeData.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt NormalizationTest.txt
    1.32  	cd ruby/ && test -e Makefile && (make clean && rm -f Makefile) || true
    1.33  	rm -Rf ruby/gem/lib ruby/gem/ext
    1.34  	rm -f ruby/gem/utf8proc-*.gem
    1.35  	cd pgsql/ && make clean
    1.36  
    1.37 +update: utf8proc_data.c.new
    1.38 +
    1.39  # real targets
    1.40  
    1.41 +utf8proc_data.c.new: UnicodeData.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt
    1.42 +	$(RUBY) data_generator.rb < UnicodeData.txt > utf8proc_data.c.new
    1.43 +
    1.44 +UnicodeData.txt:
    1.45 +
    1.46 +	$(CURL) -O http://www.unicode.org/Public/UNIDATA/UnicodeData.txt
    1.47 +
    1.48 +DerivedCoreProperties.txt:
    1.49 +	$(CURL) -O http://www.unicode.org/Public/UNIDATA/DerivedCoreProperties.txt
    1.50 +
    1.51 +CompositionExclusions.txt:
    1.52 +	$(CURL) -O http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt
    1.53 +
    1.54 +CaseFolding.txt:
    1.55 +	$(CURL) -O http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
    1.56 +
    1.57  utf8proc.o: utf8proc.h utf8proc.c utf8proc_data.c
    1.58  	$(cc) -c -o utf8proc.o utf8proc.c
    1.59  
    1.60  libutf8proc.a: utf8proc.o
    1.61  	rm -f libutf8proc.a
    1.62 -	ar rs libutf8proc.a utf8proc.o
    1.63 +	$(AR) rs libutf8proc.a utf8proc.o
    1.64  
    1.65  libutf8proc.so: utf8proc.o
    1.66 -	$(cc) -shared -o libutf8proc.so utf8proc.o
    1.67 -	chmod a-x libutf8proc.so
    1.68 +	$(cc) -shared -o libutf8proc.$(SHLIB_EXT) utf8proc.o
    1.69 +	chmod a-x libutf8proc.$(SHLIB_EXT)
    1.70  
    1.71  libutf8proc.dylib: utf8proc.o
    1.72  	$(cc) -dynamiclib -o $@ $^ -install_name $(libdir)/$@
    1.73 @@ -66,3 +94,14 @@
    1.74  		pgsql/utf8proc_pgsql.c
    1.75  	cd pgsql && make
    1.76  
    1.77 +
    1.78 +# Test programs
    1.79 +
    1.80 +NormalizationTest.txt:
    1.81 +	$(CURL) -O http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt
    1.82 +
    1.83 +normtest: normtest.c utf8proc.o utf8proc.h
    1.84 +	$(cc) normtest.c utf8proc.o -o normtest
    1.85 +
    1.86 +check: normtest NormalizationTest.txt
    1.87 +	./normtest

Impressum / About Us