forked from davidm/luacom
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile.win
170 lines (134 loc) · 5.21 KB
/
Makefile.win
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Microsoft nmake makefile for LuaCOM
# ---------------------------------------------------------------------------
# Version Information
# You must supply the Lua version being used, at least as an environment
# variable. Currently only 4 and 5 are acceptable options
# ---------------------------------------------------------------------------
LUACOM_VERSION=1.4
# ---------------------------------------------------------------------------
# Installation paths.
# You may need to modify these.
# ---------------------------------------------------------------------------
# suffix for binaries (e.g. 5.1 => lua5.1.exe)
LUA_SUFFIX = 5.1
LUA_BASE_DIR = ..\lua$(LUA_SUFFIX)
LUA_INTERPRETER = lua$(LUA_SUFFIX).exe
#this variables set by rockspec
LUALIB = lua$(LUA_SUFFIX).lib
LUA_LIBDIR = $(LUA_BASE_DIR)\lib
LUA_BINDIR = $(LUA_BASE_DIR)\bin
LUA_INCDIR = $(LUA_BASE_DIR)\include
LUA = $(LUA_BINDIR)\$(LUA_INTERPRETER)
LUAC = $(LUA) mak\luac.lua
BIN2C = $(LUA) mak\bin2c.lua
# ---------------------------------------------------------------------------
# Local source directories.
# ---------------------------------------------------------------------------
INC_DIR = .\include
LIB_DIR = .\lib
OBJ_ROOTDIR = .\obj
OBJ_DIR = $(OBJ_ROOTDIR)\lua$(LUA_SUFFIX)
BIN_DIR = .\bin
DLL_DIR = .\dll
SRC_LIB_DIR = .\src\library
SRC_BIN_DIR = .\src\bin
SRC_DLL_DIR = .\src\dll
# ---------------------------------------------------------------------------
# Compiler options
# ---------------------------------------------------------------------------
CC = cl
INCS = -I$(LUA_INCDIR) -I$(INC_DIR) -I$(SRC_LIB_DIR)
CFLAGS = -DWIN32 -D_CRT_SECURE_NO_DEPRECATE -nologo
# If you want debugging information, define DEBUG in your environment
!IFDEF DEBUG
CFLAGS =$(CFLAGS) -MDd -Zi -Od -DLUA_USE_APICHECK
!ELSE
CFLAGS =$(CFLAGS) -MD -Zi -O2 -DNDEBUG
!ENDIF
CPPFLAGS = /EHsc $(CFLAGS) $(INCS)
LUA_LIBS = $(LUA_LIBDIR)/$(LUALIB)
.SUFFIXES:
.SUFFIXES: .c .cpp .obj .lua .loh
# ---------------------------------------------------------------------------
# Linker options
# ---------------------------------------------------------------------------
DEFAULT_LIBS = \
kernel32.lib user32.lib gdi32.lib shell32.lib advapi32.lib \
ole32.lib winspool.lib uuid.lib oleaut32.lib shlwapi.lib htmlhelp.lib
!IFDEF DEBUG
LINK_USE_DEBUG = /DEBUG /PDB:NONE
!ENDIF
LIBFLAG = /nologo /subsystem:console /incremental:no /dll
# ---------------------------------------------------------------------------
# Target options
# ---------------------------------------------------------------------------
LC_LIB = $(LIB_DIR)\luacom-lua$(LUA_SUFFIX)-$(LUACOM_VERSION).lib
LC_DLL = $(BIN_DIR)\luacom.dll
LC_IMPLIB = $(LIB_DIR)\luacomdll-lua$(LUA_SUFFIX)-$(LUACOM_VERSION).lib
DEF = $(SRC_DLL_DIR)/luacom_dll.def
LIB_OBJS = \
$(OBJ_DIR)/LuaAux.obj \
$(OBJ_DIR)/luabeans.obj \
$(OBJ_DIR)/luacom.obj \
$(OBJ_DIR)/tLuaCOM.obj \
$(OBJ_DIR)/tLuaCOMException.obj \
$(OBJ_DIR)/tLuaCOMTypeHandler.obj \
$(OBJ_DIR)/tLuaDispatch.obj \
$(OBJ_DIR)/tLuaObjList.obj \
$(OBJ_DIR)/tLuaVector.obj \
$(OBJ_DIR)/tStringBuffer.obj \
$(OBJ_DIR)/tUtil.obj \
$(OBJ_DIR)/tCOMUtil.obj \
$(OBJ_DIR)/tLuaCOMClassFactory.obj \
$(OBJ_DIR)/tLuaCOMConnPoints.obj \
$(OBJ_DIR)/LuaCompat.obj \
$(OBJ_DIR)/tLuaCOMEnumerator.obj \
$(OBJ_DIR)/tLuaObject.obj \
$(OBJ_DIR)/tLuaControl.obj \
$(OBJ_DIR)/tLuaTLB.obj
DLL_OBJS = $(OBJ_DIR)/luacom_dll.obj
all: lc_lib lc_dll
lc_lib: $(LIB_DIR) $(OBJ_DIR) $(LC_LIB)
lc_dll: lc_lib $(BIN_DIR) $(OBJ_DIR) $(LC_DLL)
$(LIB_DIR)::
if not exist $(LIB_DIR) mkdir $(LIB_DIR)
$(OBJ_DIR)::
if not exist $(OBJ_DIR) mkdir $(OBJ_DIR)
$(BIN_DIR)::
if not exist $(BIN_DIR) mkdir $(BIN_DIR)
install: $(LC_DLL)
if not exist "$(LUA_LIBDIR)" mkdir -p "$(LUA_LIBDIR)"
copy $(BIN_DIR)\luacom.dll "$(LUA_LIBDIR)"
clean-obj:
if exist $(OBJ_DIR)\*.obj del $(OBJ_DIR)\*.obj
if exist $(OBJ_DIR) rmdir $(OBJ_DIR)
clean:
if exist $(OBJ_ROOTDIR) rmdir /S /Q $(OBJ_ROOTDIR)
if exist $(LIB_DIR)\*.lib del $(LIB_DIR)\*.lib
if exist $(LIB_DIR)\*.exp del $(LIB_DIR)\*.exp
if exist $(LIB_DIR) rmdir $(LIB_DIR)
if exist $(BIN_DIR)\*.exe del $(BIN_DIR)\*.exe
if exist $(BIN_DIR)\*.dll del $(BIN_DIR)\*.dll
if exist $(BIN_DIR)\*.manifest del $(BIN_DIR)\*.manifest
if exist $(BIN_DIR)\*.pdb del $(BIN_DIR)\*.pdb
if exist $(BIN_DIR) rmdir $(BIN_DIR)
if exist $(SRC_LIB_DIR)\luacom5.lo del $(SRC_LIB_DIR)\luacom5.lo
if exist $(SRC_LIB_DIR)\luacom5.loh del $(SRC_LIB_DIR)\luacom5.loh
{$(SRC_LIB_DIR)}.cpp{$(OBJ_DIR)}.obj:
$(CC) /c /DLUACOM_DLL=\"luacom.dll\" $(CPPFLAGS) $(COMPAT) /Fo$@ $<
{$(SRC_LIB_DIR)}.c{$(OBJ_DIR)}.obj:
$(CC) /c /Za $(CFLAGS) $(COMPAT) /Fo$@ $<
{$(SRC_BIN_DIR)}.cpp{$(OBJ_DIR)}.obj:
$(CC) /c $(CPPFLAGS) $(COMPAT) /Fo$@ $<
{$(SRC_DLL_DIR)}.cpp{$(OBJ_DIR)}.obj:
$(CC) /c /DLUACOM_DLL=\"luacom.dll\" $(CPPFLAGS) $(COMPAT) /Fo$@ /I$(SRC_DLL_DIR) $<
{$(SRC_LIB_DIR)}.lua{$(SRC_LIB_DIR)}.loh:
$(LUAC) -o "$*.lo" "$<"
$(BIN2C) "$*.lo" > "$@"
$(LC_LIB): $(LIB_OBJS)
lib /NOLOGO /OUT:$@ $(LIB_OBJS)
$(LC_DLL): $(LIB_OBJS) $(DLL_OBJS) $(DEF)
link $(LIBFLAG) $(LINK_USE_DEBUG) \
/IMPLIB:$(LC_IMPLIB) /out:$@ /DEF:$(DEF) \
$(LIB_OBJS) $(DLL_OBJS) $(LUA_LIBS) $(DEFAULT_LIBS)
include ./mak/dependences.mak