summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-08-30 13:21:33 +1000
committerdaurnimator <quae@daurnimator.com>2017-08-30 13:21:33 +1000
commitb92fca3b68e551d2583754c80196d524890e5ee4 (patch)
tree3dc8228b2b3d4ac3e7c1ed12aac97b42c02fd301
parent75218ba665c45e29d06b963529d300805c6b0ba6 (diff)
downloadluaossl-b92fca3b68e551d2583754c80196d524890e5ee4.tar.gz
luaossl-b92fca3b68e551d2583754c80196d524890e5ee4.tar.bz2
luaossl-b92fca3b68e551d2583754c80196d524890e5ee4.zip
Pull in updated makefile structure from cqueues
-rw-r--r--GNUmakefile205
-rw-r--r--src/GNUmakefile133
2 files changed, 210 insertions, 128 deletions
diff --git a/GNUmakefile b/GNUmakefile
index c58686c..1893378 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -9,6 +9,20 @@ GUARD_$(d) := 1
9 9
10all: # default target 10all: # default target
11 11
12#
13# G N U M A K E F U N C T I O N S
14#
15KNOWN_APIS = 5.1 5.2 5.3
16
17# template for invoking luapath script
18LUAPATH := $(d)/mk/luapath
19LUAPATH_FN = $(shell env CC='$(subst ',\\',$(CC))' CPPFLAGS='$(subst ',\\',$(CPPFLAGS))' LDFLAGS='$(subst ',\\',$(LDFLAGS))' $(LUAPATH) -krxm3 -I '$(subst ',\\',$(DESTDIR)$(includedir))' -I/usr/include -I/usr/local/include -P '$(subst ',\\',$(DESTDIR)$(bindir))' -P '$(subst ',\\',$(bindir))' -L '$(subst ',\\',$(DESTDIR)$(libdir))' -L '$(subst ',\\',$(libdir))' -v$(1) $(2))
20
21# check whether luapath can locate Lua $(1) headers
22HAVE_API_FN = $(and $(filter $(1),$(call LUAPATH_FN,$(1),version)),$(1)$(info enabling Lua $(1)))
23
24# check whether $(1) in LUA_APIS or $(LUA$(1:.=)_CPPFLAGS) is non-empty
25WITH_API_FN = $$(and $$(or $$(filter $(1),$$(LUA_APIS)),$$(LUA$(subst .,,$(1))_CPPFLAGS)),$(1))
12 26
13# 27#
14# E N V I R O N M E N T C O N F I G U R A T I O N 28# E N V I R O N M E N T C O N F I G U R A T I O N
@@ -30,47 +44,43 @@ lua53path ?= $(datadir)/lua/5.3
30AR ?= ar 44AR ?= ar
31RANLIB ?= ranlib 45RANLIB ?= ranlib
32M4 ?= m4 46M4 ?= m4
47MV ?= mv
33RM ?= rm 48RM ?= rm
34CP ?= cp 49CP ?= cp
35LN ?= ln
36LN_S ?= $(LN) -s
37RMDIR ?= rmdir 50RMDIR ?= rmdir
38MKDIR ?= mkdir 51MKDIR ?= mkdir
39CHMOD ?= chmod 52CHMOD ?= chmod
40INSTALL ?= install 53INSTALL ?= install
41INSTALL_DATA ?= $(INSTALL) -m 644 54INSTALL_DATA ?= $(INSTALL) -m 644
55TOUCH ?= touch
56TEE ?= tee
57TEE_A ?= $(TEE) -a
58
59# see Lua Autodetection, below
42 60
43.PHONY: $(d)/config 61.PHONY: $(d)/config
44 62
63PRINT_$(d) = printf "%s = %s\n" '$(1)' '$(subst ',\\',$(2))' | $(TEE_A) '$(3)'
64
65LAZY_$(d) = \
66 prefix includedir libdir datadir bindir \
67 lua51cpath lua51path lua52cpath lua52path lua53cpath lua53path \
68 CC ALL_CPPFLAGS CPPFLAGS ALL_CFLAGS CFLAGS ALL_LDFLAGS LDFLAGS \
69 ALL_SOFLAGS SOFLAGS ALL_LIB LIBS \
70 $(foreach API,$(KNOWN_APIS),ALL_LUA$(subst .,,$(API))_CPPFLAGS) \
71 AR RANLIB M4 MV RM CP RMDIR MKDIR CHMOD INSTALL INSTALL_DATA TOUCH \
72 TEE TEE_A
73
74NONLAZY_$(d) = \
75 LUA_APIS \
76 $(foreach API,$(KNOWN_APIS),LUAC$(subst .,,$(API))) \
77 $(foreach API,$(KNOWN_APIS),$(and $(call WITH_API_FN,$(API)),LUA$(subst .,,$(API))_CPPFLAGS))
78
45$(d)/config: 79$(d)/config:
46 printf 'prefix ?= $(value prefix)'"\n" >| $(@D)/.config 80 $(TOUCH) $(@D)/.config.tmp
47 printf 'includedir ?= $(value includedir)'"\n" >> $(@D)/.config 81 @$(foreach V,$(LAZY_$(@D)), $(call PRINT_$(@D),$(V),$(value $(V)),$(@D)/.config.tmp);)
48 printf 'libdir ?= $(value libdir)'"\n" >> $(@D)/.config 82 @$(foreach V,$(NONLAZY_$(@D)), $(call PRINT_$(@D),$(V),$($(V)),$(@D)/.config.tmp);)
49 printf 'datadir ?= $(value datadir)'"\n" >> $(@D)/.config 83 $(MV) $(@D)/.config.tmp $(@D)/.config
50 printf 'bindir ?= $(value bindir)'"\n" >> $(@D)/.config
51 printf 'lua51cpath ?= $(value lua51cpath)'"\n" >> $(@D)/.config
52 printf 'lua51path ?= $(value lua51path)'"\n" >> $(@D)/.config
53 printf 'lua52cpath ?= $(value lua52cpath)'"\n" >> $(@D)/.config
54 printf 'lua52path ?= $(value lua52path)'"\n" >> $(@D)/.config
55 printf 'lua53cpath ?= $(value lua53cpath)'"\n" >> $(@D)/.config
56 printf 'lua53path ?= $(value lua53path)'"\n" >> $(@D)/.config
57 printf 'CC ?= $(CC)'"\n" >> $(@D)/.config
58 printf 'CPPFLAGS ?= $(value CPPFLAGS)'"\n" >> $(@D)/.config
59 printf 'CFLAGS ?= $(value CFLAGS)'"\n" >> $(@D)/.config
60 printf 'LDFLAGS ?= $(value LDFLAGS)'"\n" >> $(@D)/.config
61 printf 'SOFLAGS ?= $(value SOFLAGS)'"\n" >> $(@D)/.config
62 printf 'AR ?= $(value AR)'"\n" >> $(@D)/.config
63 printf 'RANLIB ?= $(value RANLIB)'"\n" >> $(@D)/.config
64 printf 'M4 ?= $(value M4)'"\n" >> $(@D)/.config
65 printf 'RM ?= $(value RM)'"\n" >> $(@D)/.config
66 printf 'CP ?= $(value CP)'"\n" >> $(@D)/.config
67 printf 'LN ?= $(value LN)'"\n" >> $(@D)/.config
68 printf 'LN_S ?= $(value LN_S)'"\n" >> $(@D)/.config
69 printf 'RMDIR ?= $(value RMDIR)'"\n" >> $(@D)/.config
70 printf 'MKDIR ?= $(value MKDIR)'"\n" >> $(@D)/.config
71 printf 'CHMOD ?= $(value CHMOD)'"\n" >> $(@D)/.config
72 printf 'INSTALL ?= $(value INSTALL)'"\n" >> $(@D)/.config
73 printf 'INSTALL_DATA ?= $(value INSTALL_DATA)'"\n" >> $(@D)/.config
74 84
75# add local targets if building from inside project tree 85# add local targets if building from inside project tree
76ifneq "$(filter $(abspath $(d)/..)/%, $(abspath $(firstword $(MAKEFILE_LIST))))" "" 86ifneq "$(filter $(abspath $(d)/..)/%, $(abspath $(firstword $(MAKEFILE_LIST))))" ""
@@ -81,7 +91,49 @@ endif
81 91
82 92
83# 93#
84# S H A R E D C O M P I L A T I O N F L A G S 94# L U A A U T O D E T E C T I O N
95#
96
97# set LUA_APIS if empty or "?"
98ifeq ($(or $(strip $(LUA_APIS)),?),?)
99override LUA_APIS := $(call HAVE_API_FN,5.1) $(call HAVE_API_FN,5.2) $(call HAVE_API_FN,5.3)
100endif
101
102define LUAXY_template
103
104# set luaXYcpath if empty or "?"
105ifeq ($$(or $$(strip $$(lua$(subst .,,$(1))cpath)),?),?)
106override lua$(subst .,,$(1))cpath := $$(or $$(call LUAPATH_FN,$(1),cdir),$$(libdir)/lua/$(1))
107endif
108
109# set luaXYpath if empty or "?"
110ifeq ($$(or $$(strip $$(lua$(subst .,,$(1))path)),?),?)
111override lua$(subst .,,$(1))path = $$(or $$(call LUAPATH_FN,$(1),ldir),$$(datadir)/lua/$(1))
112endif
113
114# set LUAXY_CPPFLAGS if undefined or "?" (NB: can be empty if path already in $(CPPFLAGS))
115ifeq ($$(and $$(findstring undefined,$$(origin LUA$(subst .,,$(1))_CPPFLAGS)),?),?)
116override LUA$(subst .,,$(1))_CPPFLAGS = $$(and $$(call WITH_API_FN,$(1)),$$(call LUAPATH_FN,$(1),cppflags))
117endif
118
119# set ALL_LUAXY_CPPFLAGS if empty or "?"
120ifeq ($$(or $$(strip $$(ALL_LUA$(subst .,,$(1))_CPPFLAGS)),?),?)
121override ALL_LUA$(subst .,,$(1))_CPPFLAGS = $$(LUA$(subst .,,$(1))_CPPFLAGS)
122endif
123
124# set LUAXYC if empty or "?"
125ifeq ($$(or $$(strip $$(LUAC$(subst .,,$(1)))),?),?)
126override LUAC$(subst .,,$(1)) = $$(or $$(call LUAPATH_FN,$(1),luac),true)
127endif
128
129endef # LUAXY_template
130
131$(eval $(call LUAXY_template,5.1))
132$(eval $(call LUAXY_template,5.2))
133$(eval $(call LUAXY_template,5.3))
134
135#
136# A U T O D E T E C T C O M P I L A T I O N F L A G S
85# 137#
86cc-option ?= $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ 138cc-option ?= $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
87 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;) 139 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
@@ -89,44 +141,107 @@ cc-option ?= $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
89VENDOR_OS_$(d) := $(shell $(d)/mk/vendor.os) 141VENDOR_OS_$(d) := $(shell $(d)/mk/vendor.os)
90VENDOR_CC_$(d) := $(shell env CC="$(CC)" $(d)/mk/vendor.cc) 142VENDOR_CC_$(d) := $(shell env CC="$(CC)" $(d)/mk/vendor.cc)
91 143
144#
145# ALL_CPPFLAGS
146#
147ifeq ($(origin ALL_CPPFLAGS), undefined)
148
92ifneq ($(VENDOR_OS_$(d)), OpenBSD) 149ifneq ($(VENDOR_OS_$(d)), OpenBSD)
93CPPFLAGS_$(d) += -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE 150ALL_CPPFLAGS += -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE
94endif 151endif
95 152
96ifeq ($(VENDOR_OS_$(d)), SunOS) 153ifeq ($(VENDOR_OS_$(d)), SunOS)
97CPPFLAGS_$(d) += -Usun -D_XPG4_2 -D__EXTENSIONS__ 154ALL_CPPFLAGS += -Usun -D_XPG4_2 -D__EXTENSIONS__
98endif 155endif
99 156
157ALL_CPPFLAGS += $(CPPFLAGS)
158
159endif # ALL_CPPFLAGS
160
161#
162# ALL_CFLAGS
163#
164ifeq ($(origin ALL_CFLAGS), undefined)
165
100ifeq ($(VENDOR_CC_$(d)), gcc) 166ifeq ($(VENDOR_CC_$(d)), gcc)
101CFLAGS_$(d) += -O2 -std=gnu99 -fPIC 167ALL_CFLAGS += -O2 -std=gnu99 -fPIC
102CFLAGS_$(d) += -g -Wall -Wextra $(call cc-option, -Wno-missing-field-initializers) $(call cc-option, -Wno-override-init) -Wno-unused 168ALL_CFLAGS += -g -Wall -Wextra $(call cc-option, -Wno-missing-field-initializers) $(call cc-option, -Wno-override-init) -Wno-unused
103endif 169endif
104 170
105ifeq ($(VENDOR_CC_$(d)), clang) 171ifeq ($(VENDOR_CC_$(d)), clang)
106CFLAGS_$(d) += -O2 -std=gnu99 -fPIC 172ALL_CFLAGS += -O2 -std=gnu99 -fPIC
107CFLAGS_$(d) += -g -Wall -Wextra -Wno-missing-field-initializers -Wno-initializer-overrides -Wno-unused 173ALL_CFLAGS += -g -Wall -Wextra -Wno-missing-field-initializers -Wno-initializer-overrides -Wno-unused -Wno-dollar-in-identifier-extension
108endif 174endif
109 175
110ifeq ($(VENDOR_CC_$(d)), sunpro) 176ifeq ($(VENDOR_CC_$(d)), sunpro)
111CFLAGS_$(d) += -xcode=pic13 177ALL_CFLAGS += -xcode=pic13
112CFLAGS_$(d) += -g 178ALL_CFLAGS += -g
113# 179#
114# Solaris Studio has a brain-dead function call analyzer which counts 180# Solaris Studio supports anonymous unions just fine; but it complains
115# arguments before preprocessor expansion. 181# incessantly about them.
116# 182#
117CFLAGS_$(d) += -erroff=E_ARGUEMENT_MISMATCH 183ALL_CFLAGS += -erroff=E_ANONYMOUS_UNION_DECL
118endif 184endif
119 185
120ifeq ($(VENDOR_OS_$(d)), Darwin) 186ifeq ($(VENDOR_OS_$(d)), Darwin)
121CFLAGS_$(d) += -Wno-deprecated-declarations 187ALL_CFLAGS += -Wno-deprecated-declarations
122endif 188endif
123 189
190ALL_CFLAGS += $(CFLAGS)
191
192endif # ALL_CFLAGS
193
194#
195# ALL_SOFLAGS
196#
197ifeq ($(origin ALL_SOFLAGS), undefined)
198
124ifeq ($(VENDOR_OS_$(d)), Darwin) 199ifeq ($(VENDOR_OS_$(d)), Darwin)
125SOFLAGS_$(d) += -bundle -undefined dynamic_lookup 200ALL_SOFLAGS += -bundle -undefined dynamic_lookup
126else 201else
127SOFLAGS_$(d) += -shared 202ALL_SOFLAGS += -shared
203endif
204
205ALL_SOFLAGS += $(SOFLAGS)
206
207endif # ALL_SOFLAGS
208
209#
210# ALL_LDFLAGS
211#
212ifeq ($(origin ALL_LDFLAGS), undefined)
213
214ALL_LDFLAGS += -L$(DESTDIR)$(libdir) -L$(libdir)
215ALL_LDFLAGS += $(LDFLAGS)
216
217endif # ALL_LDFLAGS
218
219#
220# ALL_LIBS
221#
222ifeq ($(origin ALL_LIBS), undefined)
223
224# put $(LIBS) first as they're more likely to be higher-level dependencies
225ALL_LIBS += $(LIBS)
226ALL_LIBS += -lssl -lcrypto -lpthread
227
228# NetBSD, FreeBSD, OpenBSD (and presumably descendants) lack any libdl;
229# dlopen, et al are part of libc.
230ifneq ($(patsubst %BSD,BSD,$(VENDOR_OS_$(d))), BSD)
231ALL_LIBS += -ldl
128endif 232endif
129 233
234# This only seems to be necessary on Linux. Darwin and OpenBSD lack a librt.
235# On OpenBSD clock_gettime is part of libc. Others have librt, but linking
236# it in is unnecessary.
237ifeq ($(VENDOR_OS_$(d)), Linux)
238ALL_LIBS += -lrt
239endif
240
241ALL_LIBS += -lm
242
243endif # ALL_LIBS
244
130 245
131# 246#
132# P R O J E C T R U L E S 247# P R O J E C T R U L E S
diff --git a/src/GNUmakefile b/src/GNUmakefile
index 8d645ea..4bf5f8d 100644
--- a/src/GNUmakefile
+++ b/src/GNUmakefile
@@ -16,66 +16,46 @@ include $(d)/../GNUmakefile
16# 16#
17# C O M P I L A T I O N F L A G S 17# C O M P I L A T I O N F L A G S
18# 18#
19OS_$(d) = $(shell $(d)/../mk/vendor.os) 19CPPFLAGS_$(d) = $(ALL_CPPFLAGS) -DHAVE_CONFIG_H
20CC_$(d) = $(shell env CC="$(CC) "$(d)/../mk/vendor.cc) 20CFLAGS_$(d) = $(ALL_CFLAGS)
21LUAPATH_$(d) = $(shell env CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(<D)/../mk/luapath -krxm3 -I$(DESTDIR)$(includedir) -I/usr/include -I/usr/local/include -P$(DESTDIR)$(bindir) -P$(bindir) -L$(DESTDIR)$(libdir) -L$(libdir) -v$(1) $(2)) 21SOFLAGS_$(d) = $(ALL_SOFLAGS)
22 22LDFLAGS_$(d) = $(ALL_LDFLAGS)
23CPPFLAGS_$(d) = $(CPPFLAGS_$(abspath $(@D)/../..)) -DHAVE_CONFIG_H 23LIBS_$(d) = $(ALL_LIBS)
24CFLAGS_$(d) = $(CFLAGS_$(abspath $(@D)/../..))
25LDFLAGS_$(d) = $(LDFLAGS_$(abspath $(@D)/../..))
26SOFLAGS_$(d) = $(SOFLAGS_$(abspath $(@D)/../..))
27
28ifeq ($(CC_$(d)), sunpro)
29CPPFLAGS_$(d) += -DOPENSSL_NO_EC
30endif
31
32LDFLAGS_$(d) += -lssl -lcrypto -lpthread -lm
33
34# NetBSD, FreeBSD, OpenBSD (and presumably descendants) lack any libdl;
35# dlopen, et al are part of libc.
36ifneq ($(patsubst %BSD,BSD,$(OS_$(d))), BSD)
37LDFLAGS_$(d) += -ldl
38endif
39
40 24
41# 25#
42# C O M P I L A T I O N R U L E S 26# C O M P I L A T I O N R U L E S
43# 27#
28OBJS_$(d) = openssl.o
29
44$(d)/config.h: $(abspath $(d)/..)/config.h 30$(d)/config.h: $(abspath $(d)/..)/config.h
45 $(CP) $< $@ 31 $(CP) $< $@
46 32
47define BUILD_$(d) 33define BUILD_$(d)
48 34
49.SECONDARY: liblua$(1)-openssl openssl$(1) 35$$(d)/$(1)/openssl.so: $$(addprefix $$(d)/$(1)/, $$(OBJS_$(d)))
36 $$(CC) -o $$@ $$^ $$(SOFLAGS_$$(abspath $$(@D)/..)) $$(LDFLAGS_$$(abspath $$(@D)/..)) $$(LIBS_$$(abspath $$(@D)/..))
50 37
51$$(d)/$(1)/openssl.so: $$(d)/$(1)/openssl.o 38$$(d)/$(1)/%.o: $$(d)/%.c $$(d)/compat52.h $$(d)/config.h
52 $$(CC) -o $$@ $$^ $$(SOFLAGS_$$(abspath $$(@D)/..)) $$(SOFLAGS) $$(LDFLAGS_$$(abspath $$(@D)/..)) $$(LDFLAGS)
53
54$$(d)/$(1)/openssl.o: $$(d)/openssl.c $$(d)/compat52.h $$(d)/config.h
55 test "$$(notdir $$(@D))" = "$$(call LUAPATH_$$(<D), $$(notdir $$(@D)), version)"
56 $$(MKDIR) -p $$(@D) 39 $$(MKDIR) -p $$(@D)
57 $$(CC) $$(CFLAGS_$$(<D)) $$(CFLAGS) $$(call LUAPATH_$$(<D), $$(notdir $$(@D)), cppflags) $$(CPPFLAGS_$$(<D)) $$(CPPFLAGS) -c -o $$@ $$< 40 $$(CC) $$(CFLAGS_$$(<D)) $$(ALL_LUA$(subst .,,$(1))_CPPFLAGS) $$(CPPFLAGS_$$(<D)) -c -o $$@ $$<
41
42.SECONDARY: liblua$(1)-openssl openssl$(1) openssl
58 43
59liblua$(1)-openssl openssl$(1): $$(d)/$(1)/openssl.so 44liblua$(1)-openssl openssl$(1) openssl: $$(d)/$(1)/openssl.so
60 45
61endef # BUILD_$(d) 46endef # BUILD_$(d)
62 47
63$(eval $(call BUILD_$(d),5.1)) 48$(eval $(call BUILD_$(d),5.1))
64
65$(eval $(call BUILD_$(d),5.2)) 49$(eval $(call BUILD_$(d),5.2))
66
67$(eval $(call BUILD_$(d),5.3)) 50$(eval $(call BUILD_$(d),5.3))
68 51
69ifneq "$(filter $(abspath $(d)/..)/%, $(abspath $(firstword $(MAKEFILE_LIST))))" "" 52ifneq "$(filter $(abspath $(d)/..)/%, $(abspath $(firstword $(MAKEFILE_LIST))))" ""
70.SECONDARY: all5.1 all5.2 all 53.SECONDARY: all all5.1 all5.2 all5.3
71 54
72all5.1: liblua5.1-openssl 55all5.1: liblua5.1-openssl
73
74all5.2: liblua5.2-openssl 56all5.2: liblua5.2-openssl
75
76all5.3: liblua5.3-openssl 57all5.3: liblua5.3-openssl
77 58all: $(foreach API,$(strip $(LUA_APIS)),all$(API))
78all: all5.1 all5.2
79 59
80endif 60endif
81 61
@@ -85,8 +65,6 @@ endif
85# 65#
86define INSTALL_$(d) 66define INSTALL_$(d)
87 67
88LUAC$(1)_$(d) = $$(or $$(call LUAPATH_$(d), $(1), luac), true)
89
90MODS$(1)_$(d) = \ 68MODS$(1)_$(d) = \
91 $$(DESTDIR)$(2)/_openssl.so \ 69 $$(DESTDIR)$(2)/_openssl.so \
92 $$(DESTDIR)$(3)/openssl.lua \ 70 $$(DESTDIR)$(3)/openssl.lua \
@@ -116,42 +94,34 @@ MODS$(1)_$(d) = \
116 94
117.SECONDARY: liblua$(1)-openssl-install openssl$(1)-install 95.SECONDARY: liblua$(1)-openssl-install openssl$(1)-install
118 96
119$$(DESTDIR)$(2)/_openssl.so: $$(d)/$(1)/openssl.so 97liblua$(1)-openssl-install openssl$(1)-install: $$(MODS$(1)_$$(d))
120 $$(MKDIR) -p $$(@D)
121 $$(CP) -fp $$< $$@
122 98
123$$(DESTDIR)$(3)/openssl.lua: $$(d)/openssl.lua 99$$(DESTDIR)$(2)/_openssl.so: $$(d)/$(1)/openssl.so
124 $$(LUAC$(1)_$(d)) -p $$<
125 $$(MKDIR) -p $$(@D) 100 $$(MKDIR) -p $$(@D)
126 $$(CP) -p $$< $$@ 101 $$(CP) -p $$< $$@
127 102
128$$(DESTDIR)$(3)/openssl/%.lua: $$(d)/openssl.%.lua 103$$(DESTDIR)$(3)/%.lua: $$(d)/%.lua
129 $$(LUAC$(1)_$(d)) -p $$< 104 $$(LUAC$(subst .,,$(1))) -p $$<
130 $$(MKDIR) -p $$(@D) 105 $$(MKDIR) -p $$(@D)
131 $$(CP) -p $$< $$@ 106 $$(CP) -p $$< $$@
132 107
133# pubkey.lua used to be symbolic link to pkey.lua, but that caused packaging 108$$(DESTDIR)$(3)/openssl/%.lua: $$(d)/openssl.%.lua
134# headaches. Now it's a stub, but the cp -p in the inference rule will copy 109 $$(LUAC$(subst .,,$(1))) -p $$<
135# to the target of the symbolic link, so we need a special install rule to
136# clean up the mess.
137$$(DESTDIR)$(3)/openssl/pubkey.lua: $$(d)/openssl.pubkey.lua
138 $$(LUAC$(1)_$(d)) -p $$<
139 $$(MKDIR) -p $$(@D) 110 $$(MKDIR) -p $$(@D)
140 $$(RM) -f $$@
141 $$(CP) -p $$< $$@ 111 $$(CP) -p $$< $$@
142 112
143$$(DESTDIR)$(3)/openssl/ocsp/%.lua: $$(d)/openssl.ocsp.%.lua 113$$(DESTDIR)$(3)/openssl/ocsp/%.lua: $$(d)/ocsp.%.lua
144 $$(LUAC$(1)_$(d)) -p $$< 114 $$(LUAC$(subst .,,$(1))) -p $$<
145 $$(MKDIR) -p $$(@D) 115 $$(MKDIR) -p $$(@D)
146 $$(CP) -p $$< $$@ 116 $$(CP) -p $$< $$@
147 117
148$$(DESTDIR)$(3)/openssl/x509/%.lua: $$(d)/openssl.x509.%.lua 118$$(DESTDIR)$(3)/openssl/x509/%.lua: $$(d)/x509.%.lua
149 $$(LUAC$(1)_$(d)) -p $$< 119 $$(LUAC$(subst .,,$(1))) -p $$<
150 $$(MKDIR) -p $$(@D) 120 $$(MKDIR) -p $$(@D)
151 $$(CP) -p $$< $$@ 121 $$(CP) -p $$< $$@
152 122
153$$(DESTDIR)$(3)/openssl/ssl/%.lua: $$(d)/openssl.ssl.%.lua 123$$(DESTDIR)$(3)/openssl/ssl/%.lua: $$(d)/ssl.%.lua
154 $$(LUAC$(1)_$(d)) -p $$< 124 $$(LUAC$(subst .,,$(1))) -p $$<
155 $$(MKDIR) -p $$(@D) 125 $$(MKDIR) -p $$(@D)
156 $$(CP) -p $$< $$@ 126 $$(CP) -p $$< $$@
157 127
@@ -169,31 +139,24 @@ liblua$(1)-openssl-uninstall openssl$(1)-uninstall:
169endef # INSTALL_$(d) 139endef # INSTALL_$(d)
170 140
171$(eval $(call INSTALL_$(d),5.1,$$(lua51cpath),$$(lua51path))) 141$(eval $(call INSTALL_$(d),5.1,$$(lua51cpath),$$(lua51path)))
172
173$(eval $(call INSTALL_$(d),5.2,$$(lua52cpath),$$(lua52path))) 142$(eval $(call INSTALL_$(d),5.2,$$(lua52cpath),$$(lua52path)))
174
175$(eval $(call INSTALL_$(d),5.3,$$(lua53cpath),$$(lua53path))) 143$(eval $(call INSTALL_$(d),5.3,$$(lua53cpath),$$(lua53path)))
176 144
177ifneq "$(filter $(abspath $(d)/..)/%, $(abspath $(firstword $(MAKEFILE_LIST))))" "" 145ifneq "$(filter $(abspath $(d)/..)/%, $(abspath $(firstword $(MAKEFILE_LIST))))" ""
146
178.SECONDARY: install5.1 install5.2 install5.3 install 147.SECONDARY: install5.1 install5.2 install5.3 install
179 148
180install5.1: liblua5.1-openssl-install 149install5.1: liblua5.1-openssl-install
181
182install5.2: liblua5.2-openssl-install 150install5.2: liblua5.2-openssl-install
183
184install5.3: liblua5.3-openssl-install 151install5.3: liblua5.3-openssl-install
185 152install: $(foreach API,$(strip $(LUA_APIS)),install$(API))
186install: install5.1 install5.2
187 153
188.PHONY: uninstall5.1 uninstall5.2 uninstall5.3 uninstall 154.PHONY: uninstall5.1 uninstall5.2 uninstall5.3 uninstall
189 155
190uninstall5.1: liblua5.1-openssl-uninstall 156uninstall5.1: liblua5.1-openssl-uninstall
191
192uninstall5.2: liblua5.2-openssl-uninstall 157uninstall5.2: liblua5.2-openssl-uninstall
193
194uninstall5.3: liblua5.3-openssl-uninstall 158uninstall5.3: liblua5.3-openssl-uninstall
195 159uninstall: $(foreach API,$(strip $(LUA_APIS)),uninstall$(API))
196uninstall: uninstall5.1 uninstall5.2
197 160
198endif 161endif
199 162
@@ -204,7 +167,7 @@ endif
204.PHONY: $(d)/clean $(d)/clean~ clean clean~ 167.PHONY: $(d)/clean $(d)/clean~ clean clean~
205 168
206$(d)/clean: 169$(d)/clean:
207 $(RM) -fr $(@D)/*.so $(@D)/*.o $(@D)/*.dSYM $(@D)/5.1 $(@D)/5.2 $(@D)/5.3 170 $(RM) -fr $(@D)/config.h $(@D)/*.dSYM $(@D)/5.1 $(@D)/5.2 $(@D)/5.3
208 171
209$(d)/clean~: $(d)/clean 172$(d)/clean~: $(d)/clean
210 $(RM) -f $(@D)/*~ 173 $(RM) -f $(@D)/*~
@@ -221,27 +184,27 @@ clean~: $(d)/clean~
221 184
222$(d)/help: 185$(d)/help:
223 @echo 186 @echo
224 @echo "ext/ targets:" 187 @echo "src/ targets:"
225 @echo "" 188 @echo ""
226 @echo " all - build all binary targets" 189 @echo " all - build all API targets"
227 @echo "openssl - invokes openssl5.1 and openssl5.2" 190 @echo " all5.1 - build 5.1/openssl.so"
228 @echo "openssl5.1 - build 5.1/openssl.so" 191 @echo " all5.2 - build 5.2/openssl.so"
229 @echo "openssl5.2 - build 5.2/openssl.so" 192 @echo " all5.3 - build 5.3/openssl.so"
230 @echo "openssl5.3 - build 5.3/openssl.so" 193 @echo " install - install all API targets"
231 @echo "install - invokes install5.1 and install5.2" 194 @echo " install5.1 - install openssl Lua 5.1 modules"
232 @echo "install5.1 - install openssl Lua 5.1 modules" 195 @echo " install5.2 - install openssl Lua 5.2 modules"
233 @echo "install5.2 - install openssl Lua 5.2 modules" 196 @echo " install5.3 - install openssl Lua 5.3 modules"
234 @echo "install5.3 - install openssl Lua 5.3 modules" 197 @echo " uninstall - uninstall all API targets"
235 @echo "uninstall - invokes uninstall5.1 and uninstall5.2"
236 @echo "uninstall5.1 - uninstall openssl Lua 5.1 modules" 198 @echo "uninstall5.1 - uninstall openssl Lua 5.1 modules"
237 @echo "uninstall5.2 - uninstall openssl Lua 5.2 modules" 199 @echo "uninstall5.2 - uninstall openssl Lua 5.2 modules"
238 @echo "uninstall5.3 - uninstall openssl Lua 5.3 modules" 200 @echo "uninstall5.3 - uninstall openssl Lua 5.3 modules"
239 @echo " clean - rm binary targets, object files, debugging symbols, etc" 201 @echo " clean - rm binary targets, object files, debugging symbols, etc"
240 @echo " clean~ - clean + rm *~" 202 @echo " clean~ - clean + rm *~"
241 @echo " help - echo this help message" 203 @echo " help - echo this help message"
242 @echo "" 204 @echo ""
243 @echo "Some important Make variables:" 205 @echo "Some important Make variables:"
244 @echo "" 206 @echo ""
207 @echo ' LUA_APIS - default Lua APIs to target ($(LUA_APIS))'
245 @echo " prefix - path to install root ($(value prefix))" 208 @echo " prefix - path to install root ($(value prefix))"
246 @echo ' lua51path - install path for Lua 5.1 modules ($(value lua51path))' 209 @echo ' lua51path - install path for Lua 5.1 modules ($(value lua51path))'
247 @echo 'lua51cpath - install path for Lua 5.1 C modules ($(value lua51cpath))' 210 @echo 'lua51cpath - install path for Lua 5.1 C modules ($(value lua51cpath))'
@@ -250,6 +213,10 @@ $(d)/help:
250 @echo ' lua53path - install path for Lua 5.3 modules ($(value lua53path))' 213 @echo ' lua53path - install path for Lua 5.3 modules ($(value lua53path))'
251 @echo 'lua53cpath - install path for Lua 5.3 C modules ($(value lua53cpath))' 214 @echo 'lua53cpath - install path for Lua 5.3 C modules ($(value lua53cpath))'
252 @echo "" 215 @echo ""
216 @echo 'LUA51_CPPFLAGS - cpp flags for Lua 5.1 headers ($(LUA51_CPPFLAGS))'
217 @echo 'LUA52_CPPFLAGS - cpp flags for Lua 5.2 headers ($(LUA52_CPPFLAGS))'
218 @echo 'LUA53_CPPFLAGS - cpp flags for Lua 5.3 headers ($(LUA53_CPPFLAGS))'
219 @echo ""
253 @echo "(NOTE: all the common GNU-style paths are supported, including" 220 @echo "(NOTE: all the common GNU-style paths are supported, including"
254 @echo "prefix, bindir, libdir, datadir, includedir, and DESTDIR.)" 221 @echo "prefix, bindir, libdir, datadir, includedir, and DESTDIR.)"
255 @echo "" 222 @echo ""