| 1 |
TESTS = ascii.t iso.t misc.t bom.t noeol.t stdio.t |
| 2 |
|
| 3 |
d2u_os=$(shell uname -s) |
| 4 |
UCS = 1 |
| 5 |
|
| 6 |
# Checking WIN32 version in MSYS shell. |
| 7 |
ifeq ($(findstring MINGW,$(d2u_os)),MINGW) |
| 8 |
TESTS += gb18030.t |
| 9 |
else |
| 10 |
ifneq ($(findstring FreeBSD,$(d2u_os)),FreeBSD) |
| 11 |
ifneq ($(findstring Darwin,$(d2u_os)),Darwin) |
| 12 |
# Unix/Linux/Cygwin. Check if zh_CN.gb18030 locale is supported. |
| 13 |
ifeq ($(shell ./chk_loc.sh zh_CN.gb18030),yes) |
| 14 |
TESTS += gb18030.t |
| 15 |
endif |
| 16 |
endif |
| 17 |
endif |
| 18 |
endif |
| 19 |
|
| 20 |
# DOS and Windows version do not support symlinks like the Unix version. |
| 21 |
ifeq ($(DJGPP),) |
| 22 |
ifneq ($(findstring MINGW,$(d2u_os)),MINGW) |
| 23 |
TESTS += symlink.t |
| 24 |
endif |
| 25 |
endif |
| 26 |
|
| 27 |
ifeq ($(UCS),1) |
| 28 |
|
| 29 |
# Check for UTF-8 locale. Try C.UTF-8 and en_US.UTF-8. |
| 30 |
ifeq ($(shell ./chk_loc.sh C.UTF-8),yes) |
| 31 |
TESTS += utf16.t |
| 32 |
export D2U_UTF8_LOCALE = C.UTF-8 |
| 33 |
else |
| 34 |
ifeq ($(shell ./chk_loc.sh en_US.UTF-8),yes) |
| 35 |
TESTS += utf16.t |
| 36 |
export D2U_UTF8_LOCALE = en_US.UTF-8 |
| 37 |
endif |
| 38 |
endif |
| 39 |
|
| 40 |
# Checking WIN32 version in MSYS shell. |
| 41 |
ifeq ($(findstring MINGW,$(d2u_os)),MINGW) |
| 42 |
TESTS += utf16_gb.t |
| 43 |
else |
| 44 |
ifneq ($(findstring FreeBSD,$(d2u_os)),FreeBSD) |
| 45 |
ifneq ($(findstring Darwin,$(d2u_os)),Darwin) |
| 46 |
# Unix/Linux/Cygwin. Check if zh_CN.gb18030 locale is supported. |
| 47 |
ifeq ($(shell ./chk_loc.sh zh_CN.gb18030),yes) |
| 48 |
TESTS += utf16_gb.t |
| 49 |
endif |
| 50 |
endif |
| 51 |
endif |
| 52 |
endif |
| 53 |
|
| 54 |
endif |
| 55 |
|
| 56 |
ifndef DJGPP |
| 57 |
PROVE_OPT ?= --nocolor |
| 58 |
endif |
| 59 |
|
| 60 |
all: test |
| 61 |
|
| 62 |
check: test |
| 63 |
|
| 64 |
test: |
| 65 |
prove -v $(PROVE_OPT) $(TESTS) |
| 66 |
|
| 67 |
|
| 68 |
ascii: |
| 69 |
prove -v $(PROVE_OPT) [email protected] |
| 70 |
|
| 71 |
iso: |
| 72 |
prove -v $(PROVE_OPT) [email protected] |
| 73 |
|
| 74 |
misc: |
| 75 |
prove -v $(PROVE_OPT) [email protected] |
| 76 |
|
| 77 |
bom: |
| 78 |
prove -v $(PROVE_OPT) [email protected] |
| 79 |
|
| 80 |
utf16: |
| 81 |
@echo "D2U_UTF8_LOCALE=$(D2U_UTF8_LOCALE)" |
| 82 |
prove -v $(PROVE_OPT) [email protected] |
| 83 |
|
| 84 |
gb18030: |
| 85 |
prove -v $(PROVE_OPT) [email protected] |
| 86 |
|
| 87 |
utf16_gb: |
| 88 |
prove -v $(PROVE_OPT) [email protected] |
| 89 |
|
| 90 |
symlink: |
| 91 |
prove -v $(PROVE_OPT) [email protected] |
| 92 |
|
| 93 |
noeol: |
| 94 |
prove -v $(PROVE_OPT) [email protected] |
| 95 |
|
| 96 |
stdio: |
| 97 |
prove -v $(PROVE_OPT) [email protected] |
| 98 |
|
| 99 |
wcstombs: |
| 100 |
$(CC) -Wall -Wextra wcstombs_test.c -o wcstombs_test |
| 101 |
@echo "====> test wcstombs() UTF-8" |
| 102 |
LC_ALL=en_US.UTF-8 ./wcstombs_test |
| 103 |
@echo "====> test wcstombs() GB18030" |
| 104 |
LC_ALL=zh_CN.GB18030 ./wcstombs_test |
| 105 |
|
| 106 |
testu16: testu16.c |
| 107 |
gcc $< -o $@ |
| 108 |
|
| 109 |
clean: |
| 110 |
rm -f out*.txt in_link.txt wcstombs_test |