diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2011-05-25 20:57:22 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2011-05-25 20:57:22 +0000 |
| commit | 3a8ba90dfb0c2eb224f317dd692ede426691e72a (patch) | |
| tree | fe1cc5379a2e0e031663fe9c15d908653844bc73 /src/makefile | |
| parent | bce60be30fe8e9c1b0eb33128c23c93d7bca5303 (diff) | |
| download | luasocket-3a8ba90dfb0c2eb224f317dd692ede426691e72a.tar.gz luasocket-3a8ba90dfb0c2eb224f317dd692ede426691e72a.tar.bz2 luasocket-3a8ba90dfb0c2eb224f317dd692ede426691e72a.zip | |
Saving before big changes to support IPv6.
Diffstat (limited to 'src/makefile')
| -rw-r--r-- | src/makefile | 173 |
1 files changed, 112 insertions, 61 deletions
diff --git a/src/makefile b/src/makefile index 3351997..701feb3 100644 --- a/src/makefile +++ b/src/makefile | |||
| @@ -1,8 +1,13 @@ | |||
| 1 | PLAT = none | 1 | PLAT?=macosx |
| 2 | |||
| 2 | INSTALL_DATA=cp | 3 | INSTALL_DATA=cp |
| 3 | INSTALL_EXEC=cp | 4 | INSTALL_EXEC=cp |
| 4 | INSTALL_TOP= /opt/local | 5 | INSTALL_TOP=/opt/local |
| 5 | LUAINC= $(LUAINC_$(PLAT)) | 6 | |
| 7 | LUAINC_macosx=/opt/local/include | ||
| 8 | LUAINC_linux=/usr/include/lua5.1 | ||
| 9 | LUAINC_win32="../../lua-5.1.3/src" | ||
| 10 | LUALIB_win32="../../lua-5.1.3" | ||
| 6 | 11 | ||
| 7 | #------ | 12 | #------ |
| 8 | # Install directories | 13 | # Install directories |
| @@ -15,40 +20,76 @@ INSTALL_MIME_SHARE=$(INSTALL_TOP_SHARE)/mime | |||
| 15 | INSTALL_MIME_LIB=$(INSTALL_TOP_LIB)/mime | 20 | INSTALL_MIME_LIB=$(INSTALL_TOP_LIB)/mime |
| 16 | 21 | ||
| 17 | #------ | 22 | #------ |
| 18 | # Output file names | 23 | # Supported platforms |
| 19 | # | 24 | # |
| 20 | EXT=so | 25 | PLATS= macosx linux win32 |
| 21 | SOCKET_V=2.0.3 | ||
| 22 | MIME_V=1.0.3 | ||
| 23 | SOCKET_SO=socket.$(EXT).$(SOCKET_V) | ||
| 24 | MIME_SO=mime.$(EXT).$(MIME_V) | ||
| 25 | UNIX_SO=unix.$(EXT) | ||
| 26 | 26 | ||
| 27 | #------ | 27 | #------ |
| 28 | # Compiler and linker settings | 28 | # Compiler and linker settings |
| 29 | # for Mac OS X | 29 | # for Mac OS X |
| 30 | LUAINC_macosx= -I/opt/local/include | 30 | SO_macosx=so |
| 31 | O_macosx=o | ||
| 31 | CC_macosx=gcc | 32 | CC_macosx=gcc |
| 32 | DEF_macosx= -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN \ | 33 | DEF_macosx= -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN \ |
| 33 | -DLUASOCKET_API='__attribute__((visibility("default")))' \ | 34 | -DLUASOCKET_API='__attribute__((visibility("default")))' \ |
| 34 | -DMIME_API='__attribute__((visibility("default")))' | 35 | -DMIME_API='__attribute__((visibility("default")))' |
| 35 | CFLAGS_macosx= $(LUAINC) $(COMPAT) $(DEF) -pedantic -Wall -O2 -fno-common \ | 36 | CFLAGS_macosx= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \ |
| 36 | -fvisibility=hidden | 37 | -fvisibility=hidden |
| 37 | LDFLAGS_macosx= -bundle -undefined dynamic_lookup | 38 | LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o |
| 38 | LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc | 39 | LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc |
| 40 | SOCKET_macosx=usocket.o | ||
| 39 | 41 | ||
| 40 | #------ | 42 | #------ |
| 41 | # Compiler and linker settings | 43 | # Compiler and linker settings |
| 42 | # for Linux | 44 | # for Linux |
| 43 | LUAINC_linux= -I/usr/local/include/lua5.1 | 45 | SO_linux=so |
| 46 | O_linux=o | ||
| 44 | CC_linux=gcc | 47 | CC_linux=gcc |
| 45 | DEF_linux=-DLUASOCKET_DEBUG \ | 48 | DEF_linux=-DLUASOCKET_DEBUG \ |
| 46 | -DLUASOCKET_API='__attribute__((visibility("default")))' \ | 49 | -DLUASOCKET_API='__attribute__((visibility("default")))' \ |
| 47 | -DMIME_API='__attribute__((visibility("default")))' | 50 | -DMIME_API='__attribute__((visibility("default")))' |
| 48 | CFLAGS_linux= $(LUAINC) $(DEF) -pedantic -Wall -O2 -fpic \ | 51 | CFLAGS_linux= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fpic \ |
| 49 | -fvisibility=hidden | 52 | -fvisibility=hidden |
| 50 | LDFLAGS_linux=-O -shared -fpic | 53 | LDFLAGS_linux=-O -shared -fpic -o |
| 51 | LD_linux= gcc | 54 | LD_linux=gcc |
| 55 | SOCKET_linux=usocket.o | ||
| 56 | |||
| 57 | #------ | ||
| 58 | # Compiler and linker settings | ||
| 59 | # for Win32 | ||
| 60 | SO_win32=dll | ||
| 61 | O_win32=obj | ||
| 62 | CC_win32=cl | ||
| 63 | DEF_win32= /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" \ | ||
| 64 | /D "LUASOCKET_API=__declspec(dllexport)" /D "LUASOCKET_DEBUG" \ | ||
| 65 | /D "_CRT_SECURE_NO_WARNINGS" /D "_WINDLL" | ||
| 66 | CFLAGS_win32=/I$(LUAINC) $(DEF) /O2 /Ot /MD /W3 /nologo | ||
| 67 | LDFLAGS_win32= /nologo /link /NOLOGO /DLL /INCREMENTAL:NO \ | ||
| 68 | /LIBPATH:$(LUALIB) \ | ||
| 69 | /MANIFEST \ | ||
| 70 | /MANIFESTFILE:"intermediate.manifest" \ | ||
| 71 | /MANIFESTUAC:"level='asInvoker' uiAccess='false'" \ | ||
| 72 | /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /DYNAMICBASE:NO \ | ||
| 73 | /MACHINE:X86 ws2_32.lib lua5.1.lib /OUT: | ||
| 74 | LD_win32=cl | ||
| 75 | SOCKET_win32=wsocket.obj | ||
| 76 | |||
| 77 | .SUFFIXES: .obj | ||
| 78 | |||
| 79 | .c.obj: | ||
| 80 | $(CC) $(CFLAGS) /Fo"$@" /c $< | ||
| 81 | |||
| 82 | #------ | ||
| 83 | # Output file names | ||
| 84 | # | ||
| 85 | SO=$(SO_$(PLAT)) | ||
| 86 | O=$(O_$(PLAT)) | ||
| 87 | SOCKET_V=2.0.3 | ||
| 88 | MIME_V=1.0.3 | ||
| 89 | SOCKET_SO=socket.$(SO).$(SOCKET_V) | ||
| 90 | MIME_SO=mime.$(SO).$(MIME_V) | ||
| 91 | UNIX_SO=unix.$(SO) | ||
| 92 | SOCKET=$(SOCKET_$(PLAT)) | ||
| 52 | 93 | ||
| 53 | #------ | 94 | #------ |
| 54 | # Settings selected for platform | 95 | # Settings selected for platform |
| @@ -58,46 +99,48 @@ DEF=$(DEF_$(PLAT)) | |||
| 58 | CFLAGS=$(CFLAGS_$(PLAT)) | 99 | CFLAGS=$(CFLAGS_$(PLAT)) |
| 59 | LDFLAGS=$(LDFLAGS_$(PLAT)) | 100 | LDFLAGS=$(LDFLAGS_$(PLAT)) |
| 60 | LD=$(LD_$(PLAT)) | 101 | LD=$(LD_$(PLAT)) |
| 102 | LUAINC= $(LUAINC_$(PLAT)) | ||
| 103 | LUALIB= $(LUALIB_$(PLAT)) | ||
| 61 | 104 | ||
| 62 | #------ | 105 | #------ |
| 63 | # Modules belonging to socket-core | 106 | # Modules belonging to socket-core |
| 64 | # | 107 | # |
| 65 | SOCKET_OBJS= \ | 108 | SOCKET_OBJS= \ |
| 66 | luasocket.o \ | 109 | luasocket.$(O) \ |
| 67 | timeout.o \ | 110 | timeout.$(O) \ |
| 68 | buffer.o \ | 111 | buffer.$(O) \ |
| 69 | io.o \ | 112 | io.$(O) \ |
| 70 | auxiliar.o \ | 113 | auxiliar.$(O) \ |
| 71 | options.o \ | 114 | options.$(O) \ |
| 72 | inet.o \ | 115 | inet.$(O) \ |
| 73 | usocket.o \ | 116 | $(SOCKET) \ |
| 74 | except.o \ | 117 | except.$(O) \ |
| 75 | select.o \ | 118 | select.$(O) \ |
| 76 | tcp.o \ | 119 | tcp.$(O) \ |
| 77 | udp.o | 120 | udp.$(O) |
| 78 | 121 | ||
| 79 | #------ | 122 | #------ |
| 80 | # Modules belonging mime-core | 123 | # Modules belonging mime-core |
| 81 | # | 124 | # |
| 82 | MIME_OBJS= \ | 125 | MIME_OBJS= \ |
| 83 | mime.o | 126 | mime.$(O) |
| 84 | 127 | ||
| 85 | #------ | 128 | #------ |
| 86 | # Modules belonging unix (local domain sockets) | 129 | # Modules belonging unix (local domain sockets) |
| 87 | # | 130 | # |
| 88 | UNIX_OBJS:=\ | 131 | UNIX_OBJS=\ |
| 89 | buffer.o \ | 132 | buffer.$(O) \ |
| 90 | auxiliar.o \ | 133 | auxiliar.$(O) \ |
| 91 | options.o \ | 134 | options.$(O) \ |
| 92 | timeout.o \ | 135 | timeout.$(O) \ |
| 93 | io.o \ | 136 | io.$(O) \ |
| 94 | usocket.o \ | 137 | usocket.$(O) \ |
| 95 | unix.o | 138 | unix.$(O) |
| 96 | 139 | ||
| 97 | #------ | 140 | #------ |
| 98 | # Files to install | 141 | # Files to install |
| 99 | # | 142 | # |
| 100 | TO_SOCKET_SHARE:= \ | 143 | TO_SOCKET_SHARE= \ |
| 101 | http.lua \ | 144 | http.lua \ |
| 102 | url.lua \ | 145 | url.lua \ |
| 103 | tp.lua \ | 146 | tp.lua \ |
| @@ -105,33 +148,41 @@ TO_SOCKET_SHARE:= \ | |||
| 105 | headers.lua \ | 148 | headers.lua \ |
| 106 | smtp.lua | 149 | smtp.lua |
| 107 | 150 | ||
| 108 | TO_TOP_SHARE:= \ | 151 | TO_TOP_SHARE= \ |
| 109 | ltn12.lua \ | 152 | ltn12.lua \ |
| 110 | socket.lua \ | 153 | socket.lua \ |
| 111 | mime.lua | 154 | mime.lua |
| 112 | 155 | ||
| 156 | #------ | ||
| 157 | # Targets | ||
| 158 | # | ||
| 113 | default: $(PLAT) | 159 | default: $(PLAT) |
| 114 | 160 | ||
| 115 | macosx: | 161 | macosx: |
| 116 | $(MAKE) all PLAT=macosx | 162 | $(MAKE) all PLAT=macosx |
| 117 | 163 | ||
| 164 | win32: | ||
| 165 | $(MAKE) all PLAT=win32 | ||
| 166 | |||
| 118 | linux: | 167 | linux: |
| 119 | $(MAKE) all PLAT=linux | 168 | $(MAKE) all PLAT=linux |
| 120 | 169 | ||
| 121 | none: | 170 | none: |
| 122 | @echo "Please choose a platform:" | 171 | @echo "Please run" |
| 172 | @echo " make PLATFORM" | ||
| 173 | @echo "where PLATFORM is one of these:" | ||
| 123 | @echo " $(PLATS)" | 174 | @echo " $(PLATS)" |
| 124 | 175 | ||
| 125 | all: $(SOCKET_SO) $(MIME_SO) | 176 | all: $(SOCKET_SO) $(MIME_SO) |
| 126 | 177 | ||
| 127 | $(SOCKET_SO): $(SOCKET_OBJS) | 178 | $(SOCKET_SO): $(SOCKET_OBJS) |
| 128 | $(LD) $(LDFLAGS) -o $@ $(SOCKET_OBJS) | 179 | $(LD) $(SOCKET_OBJS) $(LDFLAGS)$@ |
| 129 | 180 | ||
| 130 | $(MIME_SO): $(MIME_OBJS) | 181 | $(MIME_SO): $(MIME_OBJS) |
| 131 | $(LD) $(LDFLAGS) -o $@ $(MIME_OBJS) | 182 | $(LD) $(MIME_OBJS) $(LDFLAGS)$@ |
| 132 | 183 | ||
| 133 | $(UNIX_SO): $(UNIX_OBJS) | 184 | $(UNIX_SO): $(UNIX_OBJS) |
| 134 | $(LD) $(LDFLAGS) -o $@ $(UNIX_OBJS) | 185 | $(LD) $(UNIX_OBJS) $(LDFLAGS)$@ |
| 135 | 186 | ||
| 136 | install: | 187 | install: |
| 137 | mkdir -p $(INSTALL_TOP_SHARE) | 188 | mkdir -p $(INSTALL_TOP_SHARE) |
| @@ -139,9 +190,9 @@ install: | |||
| 139 | mkdir -p $(INSTALL_SOCKET_SHARE) | 190 | mkdir -p $(INSTALL_SOCKET_SHARE) |
| 140 | $(INSTALL_DATA) $(TO_SOCKET_SHARE) $(INSTALL_SOCKET_SHARE) | 191 | $(INSTALL_DATA) $(TO_SOCKET_SHARE) $(INSTALL_SOCKET_SHARE) |
| 141 | mkdir -p $(INSTALL_SOCKET_LIB) | 192 | mkdir -p $(INSTALL_SOCKET_LIB) |
| 142 | $(INSTALL_EXEC) $(SOCKET_SO) $(INSTALL_SOCKET_LIB)/core.$(EXT) | 193 | $(INSTALL_EXEC) $(SOCKET_SO) $(INSTALL_SOCKET_LIB)/core.$(SO) |
| 143 | mkdir -p $(INSTALL_MIME_LIB) | 194 | mkdir -p $(INSTALL_MIME_LIB) |
| 144 | $(INSTALL_EXEC) $(MIME_SO) $(INSTALL_MIME_LIB)/core.$(EXT) | 195 | $(INSTALL_EXEC) $(MIME_SO) $(INSTALL_MIME_LIB)/core.$(SO) |
| 145 | 196 | ||
| 146 | local: | 197 | local: |
| 147 | $(MAKE) install INSTALL_TOP_LIB=.. INSTALL_TOP_SHARE=.. | 198 | $(MAKE) install INSTALL_TOP_LIB=.. INSTALL_TOP_SHARE=.. |
| @@ -155,24 +206,24 @@ clean: | |||
| 155 | #------ | 206 | #------ |
| 156 | # List of dependencies | 207 | # List of dependencies |
| 157 | # | 208 | # |
| 158 | auxiliar.o: auxiliar.c auxiliar.h | 209 | auxiliar.$(O): auxiliar.c auxiliar.h |
| 159 | buffer.o: buffer.c buffer.h io.h timeout.h | 210 | buffer.$(O): buffer.c buffer.h io.h timeout.h |
| 160 | except.o: except.c except.h | 211 | except.$(O): except.c except.h |
| 161 | inet.o: inet.c inet.h socket.h io.h timeout.h usocket.h | 212 | inet.$(O): inet.c inet.h socket.h io.h timeout.h usocket.h |
| 162 | io.o: io.c io.h timeout.h | 213 | io.$(O): io.c io.h timeout.h |
| 163 | luasocket.o: luasocket.c luasocket.h auxiliar.h except.h \ | 214 | luasocket.$(O): luasocket.c luasocket.h auxiliar.h except.h \ |
| 164 | timeout.h buffer.h io.h inet.h socket.h usocket.h tcp.h \ | 215 | timeout.h buffer.h io.h inet.h socket.h usocket.h tcp.h \ |
| 165 | udp.h select.h | 216 | udp.h select.h |
| 166 | mime.o: mime.c mime.h | 217 | mime.$(O): mime.c mime.h |
| 167 | options.o: options.c auxiliar.h options.h socket.h io.h \ | 218 | options.$(O): options.c auxiliar.h options.h socket.h io.h \ |
| 168 | timeout.h usocket.h inet.h | 219 | timeout.h usocket.h inet.h |
| 169 | select.o: select.c socket.h io.h timeout.h usocket.h select.h | 220 | select.$(O): select.c socket.h io.h timeout.h usocket.h select.h |
| 170 | tcp.o: tcp.c auxiliar.h socket.h io.h timeout.h usocket.h \ | 221 | tcp.$(O): tcp.c auxiliar.h socket.h io.h timeout.h usocket.h \ |
| 171 | inet.h options.h tcp.h buffer.h | 222 | inet.h options.h tcp.h buffer.h |
| 172 | timeout.o: timeout.c auxiliar.h timeout.h | 223 | timeout.$(O): timeout.c auxiliar.h timeout.h |
| 173 | udp.o: udp.c auxiliar.h socket.h io.h timeout.h usocket.h \ | 224 | udp.$(O): udp.c auxiliar.h socket.h io.h timeout.h usocket.h \ |
| 174 | inet.h options.h udp.h | 225 | inet.h options.h udp.h |
| 175 | unix.o: unix.c auxiliar.h socket.h io.h timeout.h usocket.h \ | 226 | unix.$(O): unix.c auxiliar.h socket.h io.h timeout.h usocket.h \ |
| 176 | options.h unix.h buffer.h | 227 | options.h unix.h buffer.h |
| 177 | usocket.o: usocket.c socket.h io.h timeout.h usocket.h | 228 | usocket.$(O): usocket.c socket.h io.h timeout.h usocket.h |
| 178 | wsocket.o: wsocket.c socket.h io.h timeout.h usocket.h | 229 | wsocket.$(O): wsocket.c socket.h io.h timeout.h usocket.h |
