aboutsummaryrefslogtreecommitdiff
path: root/src/makefile
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2012-04-26 13:33:01 -0700
committerSam Roberts <vieuxtech@gmail.com>2012-05-08 10:51:56 -0700
commitc291383ce26d975648ac110bf7c8ba04c65de116 (patch)
tree1f3c85d1294e154fe9b0850a8ba138e302f65b70 /src/makefile
parent04be61f88df2277fd0d2010b2deb851d9b081923 (diff)
downloadluasocket-c291383ce26d975648ac110bf7c8ba04c65de116.tar.gz
luasocket-c291383ce26d975648ac110bf7c8ba04c65de116.tar.bz2
luasocket-c291383ce26d975648ac110bf7c8ba04c65de116.zip
Rework makefiles to simplify setting and choosing build options.
Includes documentation for common build settings, reasonable defaults, and ability to set common build options in the environment.
Diffstat (limited to 'src/makefile')
-rw-r--r--src/makefile78
1 files changed, 61 insertions, 17 deletions
diff --git a/src/makefile b/src/makefile
index 6225ce4..4df62bd 100644
--- a/src/makefile
+++ b/src/makefile
@@ -1,21 +1,65 @@
1PLAT?=macosx 1# luasocket src/makefile
2#
3# Definitions in this section can be overriden on the command line or in the
4# environment.
5#
6# These are equivalent:
7#
8# export PLAT=linux DEBUG=DEBUG LUAV=5.2 prefix=/sw
9# make
10#
11# and
12#
13# make PLAT=linux DEBUG=DEBUG LUAV=5.2 prefix=/sw
14
15# PLAT: linux macosx win32
16# platform to build for
17PLAT?=linux
18
19# LUAV: 5.1 5.2
20# lua version to build against
2LUAV?=5.1 21LUAV?=5.1
3prefix=../../../build/lua/$(LUAV)
4#prefix=/usr/local
5#prefix=/opt/local
6#prefix=.
7 22
8LUAINC_macosx=../../../build/lua/$(LUAV)/include 23# DEBUG: NODEBUG DEBUG
9#LUAINC_macosx=/opt/local/include 24# debug mode causes luasocket to collect and returns timing information useful
10#LUAINC_macosx=../../../../projects/lua_env/luaenv/lua_versions/lua-5.2.0-beta/src 25# for testing and debugging luasocket itself
11#LUAINC_macosx=../../../../projects/lua_env/luaenv/lua_versions/lua-5.1.4/src 26DEBUG?=NODEBUG
12 27
13#LUAINC_linux=/usr/local/include/lua$(LUAV) 28# prefix: /usr/local /usr /opt/local /sw
14LUAINC_linux=/usr/include/lua$(LUAV) 29# the top of the default install tree
15#LUAINC_linux=/usr/local/include 30prefix?=/usr/local
31
32# where lua headers are found for macosx builds
33# LUAINC_macosx: /opt/local/include
34LUAINC_macosx?=/opt/local/include
35# FIXME default should be where fink puts lua
36
37# LUAINC_linux: /usr/include/lua$(LUAV) /usr/local/include /usr/local/include/lua$(LUAV)
38# where lua headers are found for linux builds
39LUAINC_linux?=/usr/include/lua$(LUAV)
40
41# LUAINC_win32:
42# LUALIB_win32:
43# where lua headers and libraries are found for win32 builds
44LUAINC_win32?="../../lua-5.1.3/src"
45LUALIB_win32?="../../lua-5.1.3"
46# FIXME default should be where lua-for-windows puts lua
47
48# DESTDIR: (no default)
49# used by package managers to install into a temporary destination
50DESTDIR=
51
52#------
53# Definitions below can be overridden on the make command line, but
54# shouldn't have to be.
16 55
17LUAINC_win32="../../lua-5.1.3/src" 56print:
18LUALIB_win32="../../lua-5.1.3" 57 @echo PLAT=$(PLAT)
58 @echo LUAV=$(LUAV)
59 @echo DEBUG=$(DEBUG)
60 @echo prefix=$(prefix)
61 @echo LUAINC_$(PLAT)=$(LUAINC_$(PLAT))
62 @echo LUALIB_$(PLAT)=$(LUALIB_$(PLAT))
19 63
20#------ 64#------
21# Install directories 65# Install directories
@@ -44,7 +88,7 @@ PLATS= macosx linux win32
44SO_macosx=so 88SO_macosx=so
45O_macosx=o 89O_macosx=o
46CC_macosx=gcc 90CC_macosx=gcc
47DEF_macosx= -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUA_COMPAT_MODULE \ 91DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN -DLUA_COMPAT_MODULE \
48 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 92 -DLUASOCKET_API='__attribute__((visibility("default")))' \
49 -DMIME_API='__attribute__((visibility("default")))' 93 -DMIME_API='__attribute__((visibility("default")))'
50CFLAGS_macosx= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \ 94CFLAGS_macosx= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \
@@ -59,7 +103,7 @@ SOCKET_macosx=usocket.o
59SO_linux=so 103SO_linux=so
60O_linux=o 104O_linux=o
61CC_linux=gcc 105CC_linux=gcc
62DEF_linux=-DLUASOCKET_DEBUG \ 106DEF_linux=-DLUASOCKET_$(DEBUG) \
63 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 107 -DLUASOCKET_API='__attribute__((visibility("default")))' \
64 -DMIME_API='__attribute__((visibility("default")))' 108 -DMIME_API='__attribute__((visibility("default")))'
65CFLAGS_linux= -I$(LUAINC) $(DEF) -pedantic -Wall -Wshadow -Wextra -Wimplicit -O2 -ggdb3 -fpic \ 109CFLAGS_linux= -I$(LUAINC) $(DEF) -pedantic -Wall -Wshadow -Wextra -Wimplicit -O2 -ggdb3 -fpic \
@@ -75,7 +119,7 @@ SO_win32=dll
75O_win32=obj 119O_win32=obj
76CC_win32=cl 120CC_win32=cl
77DEF_win32= /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" \ 121DEF_win32= /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" \
78 /D "LUASOCKET_API=__declspec(dllexport)" /D "LUASOCKET_DEBUG" \ 122 /D "LUASOCKET_API=__declspec(dllexport)" /D "LUASOCKET_$(DEBUG)" \
79 /D "_CRT_SECURE_NO_WARNINGS" /D "_WINDLL" 123 /D "_CRT_SECURE_NO_WARNINGS" /D "_WINDLL"
80CFLAGS_win32=/I$(LUAINC) $(DEF) /O2 /Ot /MD /W3 /nologo 124CFLAGS_win32=/I$(LUAINC) $(DEF) /O2 /Ot /MD /W3 /nologo
81LDFLAGS_win32= /nologo /link /NOLOGO /DLL /INCREMENTAL:NO \ 125LDFLAGS_win32= /nologo /link /NOLOGO /DLL /INCREMENTAL:NO \