summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
Diffstat (limited to 'windows')
-rwxr-xr-xwindows/dev-cpp/Makefile22
-rwxr-xr-xwindows/dev-cpp/_devcpp.mak36
-rwxr-xr-xwindows/dev-cpp/rex_pcre.mak75
-rwxr-xr-xwindows/dev-cpp/rex_spencer.mak72
4 files changed, 105 insertions, 100 deletions
diff --git a/windows/dev-cpp/Makefile b/windows/dev-cpp/Makefile
new file mode 100755
index 0000000..0c7fdfb
--- /dev/null
+++ b/windows/dev-cpp/Makefile
@@ -0,0 +1,22 @@
+# Makefile for lrexlib
+
+all: build test
+
+build:
+ make -f rex_pcre.mak
+ make -f rex_spencer.mak
+
+test:
+ make -f rex_pcre.mak test
+ make -f rex_spencer.mak test
+
+install:
+ make -f rex_pcre.mak install
+ make -f rex_spencer.mak install
+
+clean:
+ make -f rex_pcre.mak clean
+ make -f rex_spencer.mak clean
+
+
+.PHONY: all build test install clean
diff --git a/windows/dev-cpp/_devcpp.mak b/windows/dev-cpp/_devcpp.mak
new file mode 100755
index 0000000..2404acb
--- /dev/null
+++ b/windows/dev-cpp/_devcpp.mak
@@ -0,0 +1,36 @@
+# _common.mak: GNU Make is assumed
+
+LIBS = --add-stdcall-alias $(MYLIBS) -s
+INCS = $(MYINCS)
+BIN = $(PROJECT).dll
+DEFFILE = $(PROJECT).def
+BININSTALL= $(INSTALLPATH)\$(BIN)
+CC = gcc.exe
+CFLAGS = $(INCS) -DREX_OPENLIB=luaopen_$(PROJECT) \
+ -DREX_LIBNAME=\"$(PROJECT)\" $(MYCFLAGS)
+
+.PHONY: all install test clean
+
+vpath %.c $(SRCPATH)
+vpath %.h $(SRCPATH)
+
+all: $(BIN)
+
+clean:
+ del $(OBJ) $(BIN) $(DEFFILE)
+
+install: $(BININSTALL)
+
+test:
+ cd $(TESTPATH) && lua runtest.lua $(TESTNAME)
+
+$(BIN): $(OBJ) $(DEFFILE)
+ $(CC) $(DEFFILE) $(OBJ) $(LIBS) -o $@ -shared
+
+$(DEFFILE):
+ lua -e"print('EXPORTS') for k,v in ipairs{$(EXPORTED)} do \
+ print('\t'..v) end" > $@
+
+$(BININSTALL): $(BIN)
+ copy /Y $< $@
+
diff --git a/windows/dev-cpp/rex_pcre.mak b/windows/dev-cpp/rex_pcre.mak
index 41c0311..b47586a 100755
--- a/windows/dev-cpp/rex_pcre.mak
+++ b/windows/dev-cpp/rex_pcre.mak
@@ -1,59 +1,32 @@
-# rex_pcre.dll
+# Project: rex_pcre
-# 1. Specify root directory of Dev-Cpp (MinGW) installation
-# ---------------------------------------------------------
-ROOT = C:/Dev-Cpp
+# User Settings ------------------------------------------------------------
+# -1- path of Lua include files
+LUAINC = s:\progr\lib\lua\lua_5.1
-# 2. Specify Lua include directory and full name of Lua library
-# -------------------------------------------------------------
-INC_LUA = C:/Progr/lib/lua/lua_5.1
-LIB_LUA = C:/Progr/lib/lua/lua_5.1/liblua5.1.a
+# -2- path of PCRE include files
+REGEXINC = s:\progr\lib\pcre\pcre_7.1
-# 3. Specify PCRE include directory and full name of PCRE library
-# ---------------------------------------------------------------
-INC_REX = C:/Progr/lib/pcre/pcre_7.0
-LIB_REX = C:/Progr/lib/pcre/pcre_7.0/libpcre.a
+# -3- path of lua5.1.dll and pcre.dll
+DLLPATH = c:\exe
-# 4. Specify target name without extension
-# ----------------------------------------
-TRG = rex_pcre
+# -4- path to install rex_pcre.dll
+INSTALLPATH = s:\exe\lib\lua\5.1
+# --------------------------------------------------------------------------
-# --------------------
-# END OF USER SETTINGS
-# --------------------
+PROJECT = rex_pcre
+MYINCS = -I$(REGEXINC) -I$(LUAINC)
+MYLIBS = -L$(DLLPATH) -lpcre -llua5.1
+OBJ = lpcre.o lpcre_f.o common.o
+MYCFLAGS = -W -Wall -O2
+EXPORTED = 'luaopen_$(PROJECT)'
+SRCPATH = ..\..\src
+TESTPATH = ..\..\test
+TESTNAME = pcre
-DEFS = -DREX_OPENLIB=luaopen_$(TRG) -DREX_LIBNAME=\"$(TRG)\"
-CC = gcc.exe
-OBJ = ./lpcre.o ./common.o ./lpcre_f.o
-LINKOBJ = ./lpcre.o ./common.o ./lpcre_f.o
-LIBS = -L"$(ROOT)/lib" --no-export-all-symbols --add-stdcall-alias $(LIB_LUA) $(LIB_REX) -s
-INCS = -I"$(ROOT)/include" -I"$(INC_REX)" -I"$(INC_LUA)"
-BIN = $(TRG).dll
-CFLAGS = $(INCS) $(DEFS)
-RM = rm -f
+include _devcpp.mak
-.PHONY: all all-before all-after clean clean-custom
+lpcre.o : common.h algo.h
+lpcre_f.o : common.h
+common.o : common.h
-all: all-before $(BIN) all-after
-
-
-clean: clean-custom
- ${RM} $(OBJ) $(BIN)
-
-DLLWRAP=dllwrap.exe
-DEFFILE=lib$(TRG).def
-STATICLIB=lib$(TRG).a
-
-$(BIN): $(LINKOBJ)
- echo EXPORTS > $(DEFFILE)
- echo luaopen_$(TRG) >> $(DEFFILE)
- $(DLLWRAP) --def $(DEFFILE) --implib $(STATICLIB) $(LINKOBJ) $(LIBS) -o $(BIN)
-
-./lpcre.o: ../../src/lpcre.c
- $(CC) -c ../../src/lpcre.c -o ./lpcre.o $(CFLAGS)
-
-./common.o: ../../src/common.c
- $(CC) -c ../../src/common.c -o ./common.o $(CFLAGS)
-
-./lpcre_f.o: ../../src/lpcre_f.c
- $(CC) -c ../../src/lpcre_f.c -o ./lpcre_f.o $(CFLAGS)
diff --git a/windows/dev-cpp/rex_spencer.mak b/windows/dev-cpp/rex_spencer.mak
index 3ebe238..e1685c3 100755
--- a/windows/dev-cpp/rex_spencer.mak
+++ b/windows/dev-cpp/rex_spencer.mak
@@ -1,57 +1,31 @@
-# rex_spencer.dll
+# Project: rex_spencer
-# 1. Specify root directory of Dev-Cpp (MinGW) installation
-# ---------------------------------------------------------
-ROOT = C:/Dev-Cpp
+# User Settings ------------------------------------------------------------
+# -1- path of Lua include files
+LUAINC = s:\progr\lib\lua\lua_5.1
-# 2. Specify Lua include directory and full name of Lua library
-# -------------------------------------------------------------
-INC_LUA = C:/Progr/lib/lua/lua_5.1
-LIB_LUA = C:/Progr/lib/lua/lua_5.1/liblua5.1.a
+# -2- path of Spencer's include files
+REGEXINC = s:\progr\lib\henry_spencer
-# 3. Specify POSIX include directory and full name of POSIX library
-# -----------------------------------------------------------------
-INC_REX = C:/Progr/lib/henry_spencer
-LIB_REX = C:/Progr/lib/henry_spencer/librxspencer.dll.a
+# -3- path of lua5.1.dll and rxspencer.dll
+DLLPATH = c:\exe
-# 4. Specify target name without extension
-# ----------------------------------------
-TRG = rex_spencer
+# -4- path to install rex_spencer.dll
+INSTALLPATH = s:\exe\lib\lua\5.1
+# --------------------------------------------------------------------------
-# --------------------
-# END OF USER SETTINGS
-# --------------------
+PROJECT = rex_spencer
+MYINCS = -I$(REGEXINC) -I$(LUAINC)
+MYLIBS = -L$(DLLPATH) -lrxspencer -llua5.1
+OBJ = lposix.o common.o
+MYCFLAGS = -W -Wall -O2
+EXPORTED = 'luaopen_$(PROJECT)'
+SRCPATH = ..\..\src
+TESTPATH = ..\..\test
+TESTNAME = spencer
-DEFS = -DREX_OPENLIB=luaopen_$(TRG) -DREX_LIBNAME=\"$(TRG)\"
-CC = gcc.exe
-OBJ = ./lposix.o ./common.o
-LINKOBJ = ./lposix.o ./common.o
-LIBS = -L"$(ROOT)/lib" --no-export-all-symbols --add-stdcall-alias $(LIB_REX) $(LIB_LUA) -s
-INCS = -I"$(ROOT)/include" -I"$(INC_LUA)" -I"$(INC_REX)"
-BIN = $(TRG).dll
-#CFLAGS = $(INCS) $(DEFS) -DREX_API=__declspec(dllexport)
-CFLAGS = $(INCS) $(DEFS)
-RM = rm -f
+include _devcpp.mak
-.PHONY: all all-before all-after clean clean-custom
+lposix.o : common.h algo.h
+common.o : common.h
-all: all-before $(BIN) all-after
-
-
-clean: clean-custom
- ${RM} $(OBJ) $(BIN)
-
-DLLWRAP=dllwrap.exe
-DEFFILE=lib$(TRG).def
-STATICLIB=lib$(TRG).a
-
-$(BIN): $(LINKOBJ)
- echo EXPORTS > $(DEFFILE)
- echo luaopen_$(TRG) >> $(DEFFILE)
- $(DLLWRAP) --def $(DEFFILE) --implib $(STATICLIB) $(LINKOBJ) $(LIBS) -o $(BIN)
-
-./lposix.o: ../../src/lposix.c
- $(CC) -c ../../src/lposix.c -o ./lposix.o $(CFLAGS)
-
-./common.o: ../../src/common.c
- $(CC) -c ../../src/common.c -o ./common.o $(CFLAGS)