1# Oniguruma Makefile for Win32 2 3product_name = oniguruma 4 5CPPFLAGS = 6CFLAGS = -O2 -nologo /W3 7LDFLAGS = 8LOADLIBES = 9ARLIB = lib 10ARLIB_FLAGS = -nologo 11ARDLL = cl 12ARDLL_FLAGS = -nologo -LD $(LINKFLAGS) -dll 13LINKFLAGS = -link -incremental:no -pdb:none 14 15INSTALL = install -c 16CP = copy 17CC = cl 18DEFS = -DHAVE_CONFIG_H -DNOT_RUBY -DEXPORT 19RUBYDIR = .. 20 21subdirs = 22 23libbase = onig 24libname = $(libbase)_s.lib 25dllname = $(libbase).dll 26dlllib = $(libbase).lib 27 28onigheaders = oniguruma.h regint.h regparse.h regenc.h st.h 29posixheaders = onigposix.h 30headers = $(posixheaders) $(onigheaders) 31 32onigobjs = reggnu.obj regerror.obj regparse.obj regext.obj regcomp.obj \ 33 regexec.obj regenc.obj regsyntax.obj regtrav.obj \ 34 regversion.obj st.obj 35posixobjs = regposix.obj regposerr.obj 36libobjs = $(onigobjs) $(posixobjs) 37 38jp_objs = $(encdir)\euc_jp.obj $(encdir)\sjis.obj 39iso8859_objs = $(encdir)\iso8859_1.obj $(encdir)\iso8859_2.obj \ 40 $(encdir)\iso8859_3.obj $(encdir)\iso8859_4.obj \ 41 $(encdir)\iso8859_5.obj $(encdir)\iso8859_6.obj \ 42 $(encdir)\iso8859_7.obj $(encdir)\iso8859_8.obj \ 43 $(encdir)\iso8859_9.obj $(encdir)\iso8859_10.obj \ 44 $(encdir)\iso8859_11.obj $(encdir)\iso8859_13.obj \ 45 $(encdir)\iso8859_14.obj $(encdir)\iso8859_15.obj \ 46 $(encdir)\iso8859_16.obj 47 48encobjs = $(encdir)\ascii.obj $(encdir)\utf8.obj \ 49 $(encdir)\unicode.obj \ 50 $(encdir)\utf16_be.obj $(encdir)\utf16_le.obj \ 51 $(encdir)\utf32_be.obj $(encdir)\utf32_le.obj \ 52 $(jp_objs) $(iso8859_objs) \ 53 $(encdir)\euc_tw.obj $(encdir)\euc_kr.obj $(encdir)\big5.obj \ 54 $(encdir)\gb18030.obj \ 55 $(encdir)\koi8_r.obj \ 56 $(encdir)\cp1251.obj # $(encdir)\koi8.obj 57 58onigsources = regerror.c regparse.c regext.c regcomp.c regexec.c regenc.c \ 59 regsyntax.c regtrav.c regversion.c reggnu.c st.c 60posixsources = regposix.c regposerr.c 61libsources = $(posixsources) $(onigsources) 62rubysources = $(onigsources) 63 64encdir = enc 65patchfiles = re.c.168.patch re.c.181.patch 66distfiles = README COPYING HISTORY \ 67 Makefile.in configure.in config.h.in configure \ 68 $(headers) $(libsources) $(patchfiles) \ 69 test.rb testconv.rb 70testc = testc 71testp = testp 72 73makeargs = $(MFLAGS) CPPFLAGS='$(CPPFLAGS)' CFLAGS='$(CFLAGS)' CC='$(CC)' 74 75.SUFFIXES: 76.SUFFIXES: .obj .c .h .ps .dvi .info .texinfo 77 78.c.obj: 79 $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) /I. /I.. /Fo$@ /c $< 80 81# targets 82default: all 83 84setup: 85 $(CP) win32\config.h config.h 86 $(CP) win32\testc.c testc.c 87 88 89all: $(libname) $(dllname) 90 91$(libname): $(libobjs) $(encobjs) 92 $(ARLIB) $(ARLIB_FLAGS) -out:$@ $(libobjs) $(encobjs) 93 94$(dllname): $(libobjs) $(encobjs) 95 $(ARDLL) $(libobjs) $(encobjs) -Fe$@ $(ARDLL_FLAGS) 96 97regparse.obj: regparse.c $(onigheaders) config.h st.h 98regext.obj: regext.c $(onigheaders) config.h 99regtrav.obj: regtrav.c $(onigheaders) config.h 100regcomp.obj: regcomp.c $(onigheaders) config.h 101regexec.obj: regexec.c regint.h regenc.h oniguruma.h config.h 102reggnu.obj: reggnu.c regint.h regenc.h oniguruma.h config.h oniggnu.h 103regerror.obj: regerror.c regint.h regenc.h oniguruma.h config.h 104regenc.obj: regenc.c regenc.h oniguruma.h config.h 105regsyntax.obj: regsyntax.c regint.h regenc.h oniguruma.h config.h 106regversion.obj: regversion.c oniguruma.h config.h 107regposix.obj: regposix.c $(posixheaders) oniguruma.h config.h 108regposerr.obj: regposerr.c $(posixheaders) config.h 109st.obj: st.c regint.h oniguruma.h config.h st.h 110 111$(encdir)\ascii.obj: $(encdir)\ascii.c regenc.h config.h 112$(encdir)\unicode.obj: $(encdir)\unicode.c regenc.h config.h 113$(encdir)\utf8.obj: $(encdir)\utf8.c regenc.h config.h 114$(encdir)\utf16_be.obj: $(encdir)\utf16_be.c regenc.h config.h 115$(encdir)\utf16_le.obj: $(encdir)\utf16_le.c regenc.h config.h 116$(encdir)\utf32_be.obj: $(encdir)\utf32_be.c regenc.h config.h 117$(encdir)\utf32_le.obj: $(encdir)\utf32_le.c regenc.h config.h 118$(encdir)\euc_jp.obj: $(encdir)\euc_jp.c regenc.h config.h 119$(encdir)\euc_tw.obj: $(encdir)\euc_tw.c regenc.h config.h 120$(encdir)\euc_kr.obj: $(encdir)\euc_kr.c regenc.h config.h 121$(encdir)\sjis.obj: $(encdir)\sjis.c regenc.h config.h 122$(encdir)\iso8859_1.obj: $(encdir)\iso8859_1.c regenc.h config.h 123$(encdir)\iso8859_2.obj: $(encdir)\iso8859_2.c regenc.h config.h 124$(encdir)\iso8859_3.obj: $(encdir)\iso8859_3.c regenc.h config.h 125$(encdir)\iso8859_4.obj: $(encdir)\iso8859_4.c regenc.h config.h 126$(encdir)\iso8859_5.obj: $(encdir)\iso8859_5.c regenc.h config.h 127$(encdir)\iso8859_6.obj: $(encdir)\iso8859_6.c regenc.h config.h 128$(encdir)\iso8859_7.obj: $(encdir)\iso8859_7.c regenc.h config.h 129$(encdir)\iso8859_8.obj: $(encdir)\iso8859_8.c regenc.h config.h 130$(encdir)\iso8859_9.obj: $(encdir)\iso8859_9.c regenc.h config.h 131$(encdir)\iso8859_10.obj: $(encdir)\iso8859_10.c regenc.h config.h 132$(encdir)\iso8859_11.obj: $(encdir)\iso8859_11.c regenc.h config.h 133$(encdir)\iso8859_13.obj: $(encdir)\iso8859_13.c regenc.h config.h 134$(encdir)\iso8859_14.obj: $(encdir)\iso8859_14.c regenc.h config.h 135$(encdir)\iso8859_15.obj: $(encdir)\iso8859_15.c regenc.h config.h 136$(encdir)\iso8859_16.obj: $(encdir)\iso8859_16.c regenc.h config.h 137$(encdir)\koi8.obj: $(encdir)\koi8.c regenc.h config.h 138$(encdir)\koi8_r.obj: $(encdir)\koi8_r.c regenc.h config.h 139$(encdir)\cp1251.obj: $(encdir)\cp1251.c regenc.h config.h 140$(encdir)\big5.obj: $(encdir)\big5.c regenc.h config.h 141$(encdir)\gb18030.obj: $(encdir)\gb18030.c regenc.h config.h 142 143 144# Ruby test 145rtest: 146 $(RUBYDIR)\win32\ruby -w -Ke test.rb 147 148# C library test 149ctest: $(testc) 150 .\$(testc) 151 152# POSIX C library test 153ptest: $(testp) 154 .\$(testp) 155 156$(testc): $(testc).c $(libname) 157 $(CC) -nologo -o $(testc) -DONIG_EXTERN=extern $(testc).c $(libname) 158 159$(testp): $(testc).c $(dlllib) 160 $(CC) -nologo -DPOSIX_TEST -o $(testp) $(testc).c $(dlllib) 161 162#$(testc)u.c: test.rb testconvu.rb 163# ruby -Ke testconvu.rb test.rb > $@ 164 165$(testc)u: $(testc)u.c $(libname) 166 $(CC) -nologo -o $(testc)u -DONIG_EXTERN=extern $(testc)u.c $(libname) 167 168clean: 169 del *.obj $(encdir)\*.obj *.lib *.exp *.dll $(testp).exe $(testc).exe $(testc).obj 170 171 172# backup file suffix 173SORIG = ruby_orig 174 175# ruby 1.9 source update 17619: 177 $(CP) regerror.c $(RUBYDIR) 178 $(CP) regparse.c $(RUBYDIR) 179 $(CP) regcomp.c $(RUBYDIR) 180 $(CP) regexec.c $(RUBYDIR) 181 $(CP) regenc.c $(RUBYDIR) 182 $(CP) regint.h $(RUBYDIR) 183 $(CP) regparse.h $(RUBYDIR) 184 $(CP) regenc.h $(RUBYDIR) 185 $(CP) oniguruma.h $(RUBYDIR) 186 $(CP) enc\ascii.c $(RUBYDIR) 187 $(CP) enc\utf8.c $(RUBYDIR) 188 $(CP) enc\euc_jp.c $(RUBYDIR) 189 $(CP) enc\sjis.c $(RUBYDIR) 190 $(CP) enc\unicode.c $(RUBYDIR) 191 192 193samples: all 194 $(CC) $(CFLAGS) -I. -o simple sample\simple.c $(dlllib) 195 $(CC) $(CFLAGS) -I. -o posix sample\posix.c $(dlllib) 196 $(CC) $(CFLAGS) -I. -o names sample\names.c $(dlllib) 197 $(CC) $(CFLAGS) -I. -o listcap sample\listcap.c $(dlllib) 198 $(CC) $(CFLAGS) -I. -o sql sample\sql.c $(dlllib) 199 $(CC) $(CFLAGS) -I. -o encode sample\encode.c $(dlllib) 200 $(CC) $(CFLAGS) -I. -o syntax sample\syntax.c $(dlllib) 201