diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2012-04-26 13:33:01 -0700 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2012-05-08 10:51:56 -0700 |
commit | c291383ce26d975648ac110bf7c8ba04c65de116 (patch) | |
tree | 1f3c85d1294e154fe9b0850a8ba138e302f65b70 /src/makefile | |
parent | 04be61f88df2277fd0d2010b2deb851d9b081923 (diff) | |
download | luasocket-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/makefile | 78 |
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 @@ | |||
1 | PLAT?=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 | ||
17 | PLAT?=linux | ||
18 | |||
19 | # LUAV: 5.1 5.2 | ||
20 | # lua version to build against | ||
2 | LUAV?=5.1 | 21 | LUAV?=5.1 |
3 | prefix=../../../build/lua/$(LUAV) | ||
4 | #prefix=/usr/local | ||
5 | #prefix=/opt/local | ||
6 | #prefix=. | ||
7 | 22 | ||
8 | LUAINC_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 | 26 | DEBUG?=NODEBUG |
12 | 27 | ||
13 | #LUAINC_linux=/usr/local/include/lua$(LUAV) | 28 | # prefix: /usr/local /usr /opt/local /sw |
14 | LUAINC_linux=/usr/include/lua$(LUAV) | 29 | # the top of the default install tree |
15 | #LUAINC_linux=/usr/local/include | 30 | prefix?=/usr/local |
31 | |||
32 | # where lua headers are found for macosx builds | ||
33 | # LUAINC_macosx: /opt/local/include | ||
34 | LUAINC_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 | ||
39 | LUAINC_linux?=/usr/include/lua$(LUAV) | ||
40 | |||
41 | # LUAINC_win32: | ||
42 | # LUALIB_win32: | ||
43 | # where lua headers and libraries are found for win32 builds | ||
44 | LUAINC_win32?="../../lua-5.1.3/src" | ||
45 | LUALIB_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 | ||
50 | DESTDIR= | ||
51 | |||
52 | #------ | ||
53 | # Definitions below can be overridden on the make command line, but | ||
54 | # shouldn't have to be. | ||
16 | 55 | ||
17 | LUAINC_win32="../../lua-5.1.3/src" | 56 | print: |
18 | LUALIB_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 | |||
44 | SO_macosx=so | 88 | SO_macosx=so |
45 | O_macosx=o | 89 | O_macosx=o |
46 | CC_macosx=gcc | 90 | CC_macosx=gcc |
47 | DEF_macosx= -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -DLUA_COMPAT_MODULE \ | 91 | DEF_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")))' |
50 | CFLAGS_macosx= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \ | 94 | CFLAGS_macosx= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \ |
@@ -59,7 +103,7 @@ SOCKET_macosx=usocket.o | |||
59 | SO_linux=so | 103 | SO_linux=so |
60 | O_linux=o | 104 | O_linux=o |
61 | CC_linux=gcc | 105 | CC_linux=gcc |
62 | DEF_linux=-DLUASOCKET_DEBUG \ | 106 | DEF_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")))' |
65 | CFLAGS_linux= -I$(LUAINC) $(DEF) -pedantic -Wall -Wshadow -Wextra -Wimplicit -O2 -ggdb3 -fpic \ | 109 | CFLAGS_linux= -I$(LUAINC) $(DEF) -pedantic -Wall -Wshadow -Wextra -Wimplicit -O2 -ggdb3 -fpic \ |
@@ -75,7 +119,7 @@ SO_win32=dll | |||
75 | O_win32=obj | 119 | O_win32=obj |
76 | CC_win32=cl | 120 | CC_win32=cl |
77 | DEF_win32= /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" \ | 121 | DEF_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" |
80 | CFLAGS_win32=/I$(LUAINC) $(DEF) /O2 /Ot /MD /W3 /nologo | 124 | CFLAGS_win32=/I$(LUAINC) $(DEF) /O2 /Ot /MD /W3 /nologo |
81 | LDFLAGS_win32= /nologo /link /NOLOGO /DLL /INCREMENTAL:NO \ | 125 | LDFLAGS_win32= /nologo /link /NOLOGO /DLL /INCREMENTAL:NO \ |