summaryrefslogtreecommitdiffstats
path: root/wlite/GNUmakefile
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2006-06-29 15:58:41 +0000
committerPeter Jones <pjones@redhat.com>2006-06-29 15:58:41 +0000
commit097e9e63c1431019b1831db549e7f3686aaf34f4 (patch)
tree7156813ee826601375c54ccc3e5a0505fcf5fd08 /wlite/GNUmakefile
parentb7e280956c9fe359efe6cfd6dbeeb658fbe10465 (diff)
downloadanaconda-097e9e63c1431019b1831db549e7f3686aaf34f4.tar.gz
anaconda-097e9e63c1431019b1831db549e7f3686aaf34f4.tar.xz
anaconda-097e9e63c1431019b1831db549e7f3686aaf34f4.zip
- Fix wide character support (#196099, #186701)
Diffstat (limited to 'wlite/GNUmakefile')
-rw-r--r--wlite/GNUmakefile147
1 files changed, 147 insertions, 0 deletions
diff --git a/wlite/GNUmakefile b/wlite/GNUmakefile
new file mode 100644
index 000000000..a943376ab
--- /dev/null
+++ b/wlite/GNUmakefile
@@ -0,0 +1,147 @@
+PACKAGE = wlite
+VERSION = 0.8.1
+
+prefix := /usr/local
+exec_prefix := $(prefix)
+libdir := $(exec_prefix)/lib
+includedir := $(prefix)/include
+
+.PHONY: all
+.PHONY: check
+.PHONY: install installdirs install-strip uninstall
+.PHONY: clean distclean maintainer-clean mostlyclean
+.PHONY: dist
+
+###############################################################################
+
+ifdef SMALL
+ CDFLAGS += -DWLITE_EXTENSIONS=0
+ CDFLAGS += -DWLITE_AMBI_LOCALE=0
+ CDFLAGS += -DWLITE_ENVIRONMENT=0
+endif
+
+ifndef LARGE
+ CDFLAGS += -DWLITE_XBMP_CHAR=0
+endif
+
+ifdef DEBUG
+ CFLAGS = -O0 -g -Wall
+ ifeq "dmalloc" "$(DEBUG)"
+ CDFLAGS += -DDMALLOC_FUNC_CHECK=1
+ LDFLAGS = -ldmalloc
+ endif
+ ifeq "efence" "$(DEBUG)"
+ LDFLAGS = -lefence
+ endif
+else
+ CFLAGS = -Os -Wall
+ CDFLAGS += -DNDEBUG
+endif
+
+architecture := $(shell uname -m)
+ifneq (,$(filter x86_64 s390 s390x ppc sparc,$(architecture)))
+override CFLAGS += -fPIC
+endif
+
+ifeq "diet" "$(basename $(firstword $(CC)))"
+ FATCC = $(wordlist 2,$(words $(CC)),$(CC))
+ FATCFLAGS = $(CFLAGS) -std=gnu99
+else
+ override CFLAGS += -std=gnu99
+ FATCC = $(CC)
+ FATCFLAGS = $(CFLAGS)
+endif
+
+override CFLAGS += $(CDFLAGS)
+
+libraries = libwlite.a
+unicodeorg = CaseFolding.txt EastAsianWidth.txt UnicodeData.txt
+tests = test-wcwidth test-string test-stdlib
+includes = wlite_config.h wlite_wchar.h wlite_wctype.h wlite_stdlib.h
+functions = $(wildcard wlite_*.c)
+sources = to_c.c to_c.h $(functions) $(addsuffix .c,$(tests) $(to_c))
+members = wcmp.o $(patsubst %.c,%.o,$(functions) $(c_unidata))
+objects = to_c.o wcmp.o $(to_c) $(tests)
+archives = $(PACKAGE)-$(VERSION).tar.gz
+makefiles = $(wildcard *[mM]akefile)
+unidata = $(addsuffix .dat,$(unicodeorg))
+c_unidata = $(patsubst %.txt.dat,%.dat.c,$(unidata))
+to_c = $(patsubst %.txt.dat,to_c-%,$(unidata))
+charset_in = $(wildcard test.*.txt)
+utf8_out = $(patsubst test.%.txt,%.utf-8.txt,$(charset_in))
+
+.INTERMEDIATE: $(c_unidata)
+
+libwlite.a: libwlite.a($(members))
+libwlite.a(wcmp.o): wcmp.c $(includes)
+libwlite.a(wlite_%.o): wlite_%.c $(includes)
+libwlite.a(CaseFolding.dat.o): CaseFolding.dat.c $(includes)
+libwlite.a(EastAsianWidth.dat.o): EastAsianWidth.dat.c $(includes)
+CaseFolding.dat.c: to_c-CaseFolding CaseFolding.txt.dat $(includes)
+EastAsianWidth.dat.c: to_c-EastAsianWidth EastAsianWidth.txt.dat $(includes)
+UnicodeData.dat.c: to_c-UnicodeData UnicodeData.txt.dat $(includes)
+to_c-CaseFolding: to_c-CaseFolding.c wcmp.o to_c.o $(includes)
+to_c-EastAsianWidth: to_c-EastAsianWidth.c wcmp.o to_c.o $(includes)
+to_c-UnicodeData: to_c-UnicodeData.c wcmp.o to_c.o $(includes)
+to_c.o: to_c.c to_c.h $(includes)
+ $(FATCC) $(FATCFLAGS) -c -o $@ $<
+$(archives): $(unidata) $(sources) $(charset_in) $(includes)
+$(includes): $(makefiles)
+
+test-wcwidth: test-wcwidth.c $(libraries)
+test-string: test-string.c $(libraries)
+test-stdlib: test-stdlib.c $(libraries)
+
+TAGS tags: $(sources)
+ -etags $(filter %.c,$^)
+ -ctags $(filter %.c,$^)
+
+%.h: $(makefiles)
+ sed -e "s/\(\$$package\>\)[^$$]*/\1: $(PACKAGE) /gI" \
+ -e "s/\(\$$version\>\)[^$$]*/\1: $(VERSION) /gI" $@ > $@.tmp
+ mv $@.tmp $@
+%: %.c
+ $(FATCC) $(FATCFLAGS) $(LDFLAGS) -o $@ $(filter %.c %.o %.a,$^)
+%.dat.c: %.txt.dat
+ cat $(filter %.txt.dat,$^) | \
+ $(CURDIR)/$(patsubst %.dat.c,to_c-%,$@) > $@ 2> /dev/null
+%.utf-8.txt: test.%.txt
+ iconv -f $* -t $(subst .,,$(suffix $(basename $@))) < $< > $@
+%.exclude:
+ echo $(notdir $(CURDIR))/$@ > $@
+ for x in $(wildcard $@ RCS .[^.]* *.tar.*); \
+ do echo $(notdir $(CURDIR))/$${x} >> $@; \
+ done
+ echo $(notdir $(CURDIR))/$(basename $@).tar >> $@
+%.tar: %.exclude
+ tar cv -C .. -X $< -f $@ $(notdir $(CURDIR))
+%.tar.bz2: %.tar
+ bzip2 -9 -c $< > $@
+%.tar.gz: %.tar
+ gzip -9 -c $< > $@
+
+all: $(libraries)
+check: $(tests) $(utf8_out)
+ for test in $(filter $(tests),$+); \
+ do cat $(filter $(utf8_out),$+) | ./$${test}; \
+ done
+clean: mostlyclean
+ $(RM) $(libraries) $(utf8_out)
+dist: maintainer-clean
+ $(MAKE) $(archives)
+distclean: clean
+ $(RM) $(members) $(c_unidata)
+maintainer-clean: distclean
+ $(RM) $(archives) TAGS tags $(wildcard core core.*) $(wildcard *.tmp)
+mostlyclean:
+ $(RM) $(objects)
+install: installdirs $(includes) $(libraries)
+ install $(filter $(libraries),$^) $(libdir)
+ install -m 644 $(filter $(includes),$^) $(includedir)
+installdirs: $(libdir) $(includedir)
+ install -d $^
+install-strip: install
+ for symbols in $(libraries); do strip -x -g $(libdir)/$${symbols}; done
+uninstall:
+ for installed in $(libraries); do $(RM) $(libdir)/$${installed}; done
+ for installed in $(includes); do $(RM) $(includedir)/$${installed}; done