diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2009-05-27 09:31:38 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2009-05-27 09:31:38 +0000 |
commit | bce60be30fe8e9c1b0eb33128c23c93d7bca5303 (patch) | |
tree | 3927343c777fcb7764a0f2f89754a0ceab141c21 /src/makefile | |
parent | d1a72435d5bd3528f3c334cd4d1da16dcead47bf (diff) | |
download | luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.tar.gz luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.tar.bz2 luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.zip |
Decent makefiles!
Diffstat (limited to 'src/makefile')
-rw-r--r-- | src/makefile | 156 |
1 files changed, 122 insertions, 34 deletions
diff --git a/src/makefile b/src/makefile index b614f77..3351997 100644 --- a/src/makefile +++ b/src/makefile | |||
@@ -1,39 +1,86 @@ | |||
1 | PLAT = none | ||
2 | INSTALL_DATA=cp | ||
3 | INSTALL_EXEC=cp | ||
4 | INSTALL_TOP= /opt/local | ||
5 | LUAINC= $(LUAINC_$(PLAT)) | ||
6 | |||
1 | #------ | 7 | #------ |
2 | # Load configuration | 8 | # Install directories |
3 | # | 9 | # |
4 | include ../config | 10 | INSTALL_TOP_SHARE=$(INSTALL_TOP)/share/lua/5.1 |
11 | INSTALL_TOP_LIB=$(INSTALL_TOP)/lib/lua/5.1 | ||
12 | INSTALL_SOCKET_SHARE=$(INSTALL_TOP_SHARE)/socket | ||
13 | INSTALL_SOCKET_LIB=$(INSTALL_TOP_LIB)/socket | ||
14 | INSTALL_MIME_SHARE=$(INSTALL_TOP_SHARE)/mime | ||
15 | INSTALL_MIME_LIB=$(INSTALL_TOP_LIB)/mime | ||
5 | 16 | ||
6 | #------ | 17 | #------ |
7 | # Hopefully no need to change anything below this line | 18 | # Output file names |
8 | # | 19 | # |
20 | EXT=so | ||
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) | ||
9 | 26 | ||
10 | #------ | 27 | #------ |
11 | # Modules belonging to socket-core | 28 | # Compiler and linker settings |
12 | # | 29 | # for Mac OS X |
30 | LUAINC_macosx= -I/opt/local/include | ||
31 | CC_macosx=gcc | ||
32 | DEF_macosx= -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN \ | ||
33 | -DLUASOCKET_API='__attribute__((visibility("default")))' \ | ||
34 | -DMIME_API='__attribute__((visibility("default")))' | ||
35 | CFLAGS_macosx= $(LUAINC) $(COMPAT) $(DEF) -pedantic -Wall -O2 -fno-common \ | ||
36 | -fvisibility=hidden | ||
37 | LDFLAGS_macosx= -bundle -undefined dynamic_lookup | ||
38 | LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc | ||
13 | 39 | ||
14 | #$(COMPAT)/compat-5.1.o \ | 40 | #------ |
41 | # Compiler and linker settings | ||
42 | # for Linux | ||
43 | LUAINC_linux= -I/usr/local/include/lua5.1 | ||
44 | CC_linux=gcc | ||
45 | DEF_linux=-DLUASOCKET_DEBUG \ | ||
46 | -DLUASOCKET_API='__attribute__((visibility("default")))' \ | ||
47 | -DMIME_API='__attribute__((visibility("default")))' | ||
48 | CFLAGS_linux= $(LUAINC) $(DEF) -pedantic -Wall -O2 -fpic \ | ||
49 | -fvisibility=hidden | ||
50 | LDFLAGS_linux=-O -shared -fpic | ||
51 | LD_linux= gcc | ||
15 | 52 | ||
16 | SOCKET_OBJS:= \ | 53 | #------ |
54 | # Settings selected for platform | ||
55 | # | ||
56 | CC=$(CC_$(PLAT)) | ||
57 | DEF=$(DEF_$(PLAT)) | ||
58 | CFLAGS=$(CFLAGS_$(PLAT)) | ||
59 | LDFLAGS=$(LDFLAGS_$(PLAT)) | ||
60 | LD=$(LD_$(PLAT)) | ||
61 | |||
62 | #------ | ||
63 | # Modules belonging to socket-core | ||
64 | # | ||
65 | SOCKET_OBJS= \ | ||
17 | luasocket.o \ | 66 | luasocket.o \ |
18 | timeout.o \ | 67 | timeout.o \ |
19 | buffer.o \ | 68 | buffer.o \ |
20 | io.o \ | 69 | io.o \ |
21 | auxiliar.o \ | 70 | auxiliar.o \ |
22 | options.o \ | 71 | options.o \ |
23 | inet.o \ | 72 | inet.o \ |
24 | tcp.o \ | 73 | usocket.o \ |
25 | udp.o \ | ||
26 | except.o \ | 74 | except.o \ |
27 | select.o \ | 75 | select.o \ |
28 | usocket.o | 76 | tcp.o \ |
77 | udp.o | ||
29 | 78 | ||
30 | #------ | 79 | #------ |
31 | # Modules belonging mime-core | 80 | # Modules belonging mime-core |
32 | # | 81 | # |
33 | #$(COMPAT)/compat-5.1.o \ | 82 | MIME_OBJS= \ |
34 | 83 | mime.o | |
35 | MIME_OBJS:=\ | ||
36 | mime.o | ||
37 | 84 | ||
38 | #------ | 85 | #------ |
39 | # Modules belonging unix (local domain sockets) | 86 | # Modules belonging unix (local domain sockets) |
@@ -47,7 +94,35 @@ UNIX_OBJS:=\ | |||
47 | usocket.o \ | 94 | usocket.o \ |
48 | unix.o | 95 | unix.o |
49 | 96 | ||
50 | all: $(SOCKET_SO) $(MIME_SO) | 97 | #------ |
98 | # Files to install | ||
99 | # | ||
100 | TO_SOCKET_SHARE:= \ | ||
101 | http.lua \ | ||
102 | url.lua \ | ||
103 | tp.lua \ | ||
104 | ftp.lua \ | ||
105 | headers.lua \ | ||
106 | smtp.lua | ||
107 | |||
108 | TO_TOP_SHARE:= \ | ||
109 | ltn12.lua \ | ||
110 | socket.lua \ | ||
111 | mime.lua | ||
112 | |||
113 | default: $(PLAT) | ||
114 | |||
115 | macosx: | ||
116 | $(MAKE) all PLAT=macosx | ||
117 | |||
118 | linux: | ||
119 | $(MAKE) all PLAT=linux | ||
120 | |||
121 | none: | ||
122 | @echo "Please choose a platform:" | ||
123 | @echo " $(PLATS)" | ||
124 | |||
125 | all: $(SOCKET_SO) $(MIME_SO) | ||
51 | 126 | ||
52 | $(SOCKET_SO): $(SOCKET_OBJS) | 127 | $(SOCKET_SO): $(SOCKET_OBJS) |
53 | $(LD) $(LDFLAGS) -o $@ $(SOCKET_OBJS) | 128 | $(LD) $(LDFLAGS) -o $@ $(SOCKET_OBJS) |
@@ -58,6 +133,25 @@ $(MIME_SO): $(MIME_OBJS) | |||
58 | $(UNIX_SO): $(UNIX_OBJS) | 133 | $(UNIX_SO): $(UNIX_OBJS) |
59 | $(LD) $(LDFLAGS) -o $@ $(UNIX_OBJS) | 134 | $(LD) $(LDFLAGS) -o $@ $(UNIX_OBJS) |
60 | 135 | ||
136 | install: | ||
137 | mkdir -p $(INSTALL_TOP_SHARE) | ||
138 | $(INSTALL_DATA) $(TO_TOP_SHARE) $(INSTALL_TOP_SHARE) | ||
139 | mkdir -p $(INSTALL_SOCKET_SHARE) | ||
140 | $(INSTALL_DATA) $(TO_SOCKET_SHARE) $(INSTALL_SOCKET_SHARE) | ||
141 | mkdir -p $(INSTALL_SOCKET_LIB) | ||
142 | $(INSTALL_EXEC) $(SOCKET_SO) $(INSTALL_SOCKET_LIB)/core.$(EXT) | ||
143 | mkdir -p $(INSTALL_MIME_LIB) | ||
144 | $(INSTALL_EXEC) $(MIME_SO) $(INSTALL_MIME_LIB)/core.$(EXT) | ||
145 | |||
146 | local: | ||
147 | $(MAKE) install INSTALL_TOP_LIB=.. INSTALL_TOP_SHARE=.. | ||
148 | |||
149 | clean: | ||
150 | rm -f $(SOCKET_SO) $(SOCKET_OBJS) | ||
151 | rm -f $(MIME_SO) $(UNIX_SO) $(MIME_OBJS) $(UNIX_OBJS) | ||
152 | |||
153 | .PHONY: all $(PLATS) default clean echo none | ||
154 | |||
61 | #------ | 155 | #------ |
62 | # List of dependencies | 156 | # List of dependencies |
63 | # | 157 | # |
@@ -66,25 +160,19 @@ buffer.o: buffer.c buffer.h io.h timeout.h | |||
66 | except.o: except.c except.h | 160 | except.o: except.c except.h |
67 | inet.o: inet.c inet.h socket.h io.h timeout.h usocket.h | 161 | inet.o: inet.c inet.h socket.h io.h timeout.h usocket.h |
68 | io.o: io.c io.h timeout.h | 162 | io.o: io.c io.h timeout.h |
69 | luasocket.o: luasocket.c luasocket.h auxiliar.h except.h timeout.h \ | 163 | luasocket.o: luasocket.c luasocket.h auxiliar.h except.h \ |
70 | buffer.h io.h inet.h socket.h usocket.h tcp.h udp.h select.h | 164 | timeout.h buffer.h io.h inet.h socket.h usocket.h tcp.h \ |
165 | udp.h select.h | ||
71 | mime.o: mime.c mime.h | 166 | mime.o: mime.c mime.h |
72 | options.o: options.c auxiliar.h options.h socket.h io.h timeout.h \ | 167 | options.o: options.c auxiliar.h options.h socket.h io.h \ |
73 | usocket.h inet.h | 168 | timeout.h usocket.h inet.h |
74 | select.o: select.c socket.h io.h timeout.h usocket.h select.h | 169 | select.o: select.c socket.h io.h timeout.h usocket.h select.h |
75 | tcp.o: tcp.c auxiliar.h socket.h io.h timeout.h usocket.h inet.h \ | 170 | tcp.o: tcp.c auxiliar.h socket.h io.h timeout.h usocket.h \ |
76 | options.h tcp.h buffer.h | 171 | inet.h options.h tcp.h buffer.h |
77 | timeout.o: timeout.c auxiliar.h timeout.h | 172 | timeout.o: timeout.c auxiliar.h timeout.h |
78 | udp.o: udp.c auxiliar.h socket.h io.h timeout.h usocket.h inet.h \ | 173 | udp.o: udp.c auxiliar.h socket.h io.h timeout.h usocket.h \ |
79 | options.h udp.h | 174 | inet.h options.h udp.h |
80 | unix.o: unix.c auxiliar.h socket.h io.h timeout.h usocket.h options.h \ | 175 | unix.o: unix.c auxiliar.h socket.h io.h timeout.h usocket.h \ |
81 | unix.h buffer.h | 176 | options.h unix.h buffer.h |
82 | usocket.o: usocket.c socket.h io.h timeout.h usocket.h | 177 | usocket.o: usocket.c socket.h io.h timeout.h usocket.h |
83 | 178 | wsocket.o: wsocket.c socket.h io.h timeout.h usocket.h | |
84 | clean: | ||
85 | rm -f $(SOCKET_SO) $(SOCKET_OBJS) | ||
86 | rm -f $(MIME_SO) $(UNIX_SO) $(MIME_OBJS) $(UNIX_OBJS) | ||
87 | |||
88 | #------ | ||
89 | # End of makefile configuration | ||
90 | # | ||