File: Makefile.win

package info (click to toggle)
lua-apr 0.23.2.dfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid, stretch
  • size: 1,020 kB
  • ctags: 1,075
  • sloc: ansic: 8,836; makefile: 157; sh: 20
file content (156 lines) | stat: -rw-r--r-- 5,418 bytes parent folder | download | duplicates (3)
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
# This is the Windows makefile for the Lua/APR binding.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: November 20, 2011
# Homepage: http://peterodding.com/code/lua/apr/
# License: MIT
#
# This makefile has been tested on Windows XP with NMAKE from the free
# Microsoft Visual C++ 2010 Express tool chain. You may want to change the
# following settings:

# The directories where "lua.h" and "lua51.lib" can be found (these defaults
# are based on the directory structure used by Lua for Windows v5.1.4-40).
LUA_DIR = C:\Program Files\Lua\5.1
LUA_INCDIR = $(LUA_DIR)\include
LUA_LIBDIR = $(LUA_DIR)\clibs
LUA_LINKDIR = $(LUA_DIR)\lib
LUA_SHAREDIR = $(LUA_DIR)\lua

# The directories where "apr.h" and "libapr-1.lib" can be found.
APR_INCDIR = C:\lua-apr\apr\include
APR_LIBDIR = C:\lua-apr\apr\release

# The directories where "apu.h" and "libaprutil-1.lib" can be found.
APU_INCDIR = C:\lua-apr\apr-util\include
APU_LIBDIR = C:\lua-apr\apr-util\release

# The directory where "libapriconv-1.lib" can be found.
API_LIBDIR = C:\lua-apr\apr-iconv\release

# The directories where "apreq.h" and "libapreq-2.lib" can be found.
APREQ_INCDIR = C:\lua-apr\libapreq2\include
APREQ_LIBDIR = C:\lua-apr\libapreq2\win32\libs

# You shouldn't need to change anything below here.

BINARY_MODULE = core.dll
APREQ_BINARY = apreq.dll

# Compiler and linker flags composed from the above settings.
CFLAGS = "/I$(LUA_INCDIR)" "/I$(APR_INCDIR)" "/I$(APU_INCDIR)" /D"_CRT_SECURE_NO_DEPRECATE"
LFLAGS = "/LIBPATH:$(LUA_LINKDIR)" lua51.lib "/LIBPATH:$(APR_LIBDIR)" libapr-1.lib "/LIBPATH:$(APU_LIBDIR)" libaprutil-1.lib Wldap32.Lib

# Names of compiled object files (the individual lines enable automatic
# rebasing between git feature branches and the master branch).
OBJECTS = src\base64.obj \
		  src\buffer.obj \
		  src\crypt.obj \
		  src\date.obj \
		  src\dbd.obj \
		  src\dbm.obj \
		  src\env.obj \
		  src\errno.obj \
		  src\filepath.obj \
		  src\fnmatch.obj \
		  src\getopt.obj \
		  src\http.obj \
		  src\io_dir.obj \
		  src\io_file.obj \
		  src\io_net.obj \
		  src\io_pipe.obj \
		  src\ldap.obj \
		  src\lua_apr.obj \
		  src\memcache.obj \
		  src\memory_pool.obj \
		  src\object.obj \
		  src\permissions.obj \
		  src\pollset.obj \
		  src\proc.obj \
		  src\serialize.obj \
		  src\shm.obj \
		  src\signal.obj \
		  src\stat.obj \
		  src\str.obj \
		  src\thread.obj \
		  src\thread_queue.obj \
		  src\time.obj \
		  src\uri.obj \
		  src\user.obj \
		  src\uuid.obj \
		  src\xlate.obj \
		  src\xml.obj

# Create debug builds by default but enable release builds
# using the command line "NMAKE /f Makefile.win RELEASE=1".
!IFNDEF RELEASE
CFLAGS = $(CFLAGS) /Zi /Fd"core.pdb" /DDEBUG
LFLAGS = $(LFLAGS) /debug
!ENDIF

# Experimental support for HTTP request parsing using libapreq2.
CFLAGS = $(CFLAGS) "/I$(APREQ_INCDIR)" /DLUA_APR_HAVE_APREQ=1
LFLAGS = $(LFLAGS) "/LIBPATH:$(APREQ_LIBDIR)" libapreq2.lib

# Build the binary module.
$(BINARY_MODULE): $(OBJECTS) Makefile
	@LINK /nologo /dll /out:$@ $(OBJECTS) $(LFLAGS)
	@IF EXIST $@.manifest MT -nologo -manifest $@.manifest -outputresource:$@;2

# Build the standalone libapreq2 binding.
$(APREQ_BINARY): etc\apreq_standalone.c
	CD etc && CL /W3 /nologo /MD /D"WIN32" /D"LUA_BUILD_AS_DLL" $(CFLAGS) /TC /c apreq_standalone.c
	LINK /nologo /dll /out:$@ etc\apreq_standalone.obj $(LFLAGS)
	IF EXIST $@.manifest MT -nologo -manifest $@.manifest -outputresource:$@;2

# Compile individual source code files to object files.
$(OBJECTS): Makefile
.c.obj:
	@CL /W3 /nologo /MD /D"WIN32" /D"LUA_BUILD_AS_DLL" $(CFLAGS) /TC /c $< /Fo$@

# Always try to regenerate the error handling module.
src\errno.c: etc\errors.lua
	@LUA etc\errors.lua > src\errno.c.new && MOVE src\errno.c.new src\errno.c || EXIT /B 0

# Install the Lua/APR binding and external dependencies.
install: $(BINARY_MODULE)
	COPY src\apr.lua "$(LUA_SHAREDIR)"
	IF NOT EXIST "$(LUA_SHAREDIR)\apr" MD "$(LUA_SHAREDIR)\apr"
	IF NOT EXIST "$(LUA_SHAREDIR)\apr\test" MD "$(LUA_SHAREDIR)\apr\test"
	COPY test\*.lua "$(LUA_SHAREDIR)\apr\test"
	IF NOT EXIST "$(LUA_LIBDIR)\apr" MD "$(LUA_LIBDIR)\apr"
	COPY $(BINARY_MODULE) "$(LUA_LIBDIR)\apr"
	COPY "$(APR_LIBDIR)\libapr-1.dll" "$(LUA_DIR)"
	COPY "$(APU_LIBDIR)\libaprutil-1.dll" "$(LUA_DIR)"
	COPY "$(API_LIBDIR)\libapriconv-1.dll" "$(LUA_DIR)"
	IF EXIST "$(APREQ_LIBDIR)\libapreq2.dll" COPY "$(APREQ_LIBDIR)\libapreq2.dll" "$(LUA_DIR)"

# Remove previously installed files.
uninstall:
	DEL "$(LUA_SHAREDIR)\apr.lua"
	DEL "$(LUA_SHAREDIR)\apr\test\*.lua"
	RD "$(LUA_SHAREDIR)\apr\test"
	RD "$(LUA_SHAREDIR)\apr"
	DEL "$(LUA_LIBDIR)\apr\$(BINARY_MODULE)"
	RD "$(LUA_LIBDIR)\apr"
	DEL "$(LUA_DIR)\libapr-1.dll"
	DEL "$(LUA_DIR)\libaprutil-1.dll"
	DEL "$(LUA_DIR)\libapriconv-1.dll"
	IF EXIST "$(LUA_DIR)\libapreq2.dll" DEL "$(LUA_DIR)\libapreq2.dll"

# Run the test suite.
test: install
	LUA -e "require 'apr.test' ()"

# Debug the test suite using NTSD.
debug:
	NTSD -g LUA -e "require 'apr.test' ()"

# Clean generated files from working directory.
clean:
	DEL $(OBJECTS) $(BINARY_MODULE) core.lib core.exp core.pdb core.ilk core.dll.manifest 2>NUL
	DEL $(APREQ_BINARY) apreq.lib apreq.exp apreq.pdb apreq.ilk 2>NUL

.PHONY: install uninstall test debug clean

# vim: ts=4 sw=4