diff options
| author | daurnimator <quae@daurnimator.com> | 2017-08-30 13:21:33 +1000 |
|---|---|---|
| committer | daurnimator <quae@daurnimator.com> | 2017-08-30 13:21:33 +1000 |
| commit | b92fca3b68e551d2583754c80196d524890e5ee4 (patch) | |
| tree | 3dc8228b2b3d4ac3e7c1ed12aac97b42c02fd301 /src | |
| parent | 75218ba665c45e29d06b963529d300805c6b0ba6 (diff) | |
| download | luaossl-b92fca3b68e551d2583754c80196d524890e5ee4.tar.gz luaossl-b92fca3b68e551d2583754c80196d524890e5ee4.tar.bz2 luaossl-b92fca3b68e551d2583754c80196d524890e5ee4.zip | |
Pull in updated makefile structure from cqueues
Diffstat (limited to 'src')
| -rw-r--r-- | src/GNUmakefile | 133 |
1 files changed, 50 insertions, 83 deletions
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 | # |
| 19 | OS_$(d) = $(shell $(d)/../mk/vendor.os) | 19 | CPPFLAGS_$(d) = $(ALL_CPPFLAGS) -DHAVE_CONFIG_H |
| 20 | CC_$(d) = $(shell env CC="$(CC) "$(d)/../mk/vendor.cc) | 20 | CFLAGS_$(d) = $(ALL_CFLAGS) |
| 21 | LUAPATH_$(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)) | 21 | SOFLAGS_$(d) = $(ALL_SOFLAGS) |
| 22 | 22 | LDFLAGS_$(d) = $(ALL_LDFLAGS) | |
| 23 | CPPFLAGS_$(d) = $(CPPFLAGS_$(abspath $(@D)/../..)) -DHAVE_CONFIG_H | 23 | LIBS_$(d) = $(ALL_LIBS) |
| 24 | CFLAGS_$(d) = $(CFLAGS_$(abspath $(@D)/../..)) | ||
| 25 | LDFLAGS_$(d) = $(LDFLAGS_$(abspath $(@D)/../..)) | ||
| 26 | SOFLAGS_$(d) = $(SOFLAGS_$(abspath $(@D)/../..)) | ||
| 27 | |||
| 28 | ifeq ($(CC_$(d)), sunpro) | ||
| 29 | CPPFLAGS_$(d) += -DOPENSSL_NO_EC | ||
| 30 | endif | ||
| 31 | |||
| 32 | LDFLAGS_$(d) += -lssl -lcrypto -lpthread -lm | ||
| 33 | |||
| 34 | # NetBSD, FreeBSD, OpenBSD (and presumably descendants) lack any libdl; | ||
| 35 | # dlopen, et al are part of libc. | ||
| 36 | ifneq ($(patsubst %BSD,BSD,$(OS_$(d))), BSD) | ||
| 37 | LDFLAGS_$(d) += -ldl | ||
| 38 | endif | ||
| 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 | # |
| 28 | OBJS_$(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 | ||
| 47 | define BUILD_$(d) | 33 | define 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 | ||
| 59 | liblua$(1)-openssl openssl$(1): $$(d)/$(1)/openssl.so | 44 | liblua$(1)-openssl openssl$(1) openssl: $$(d)/$(1)/openssl.so |
| 60 | 45 | ||
| 61 | endef # BUILD_$(d) | 46 | endef # 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 | ||
| 69 | ifneq "$(filter $(abspath $(d)/..)/%, $(abspath $(firstword $(MAKEFILE_LIST))))" "" | 52 | ifneq "$(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 | ||
| 72 | all5.1: liblua5.1-openssl | 55 | all5.1: liblua5.1-openssl |
| 73 | |||
| 74 | all5.2: liblua5.2-openssl | 56 | all5.2: liblua5.2-openssl |
| 75 | |||
| 76 | all5.3: liblua5.3-openssl | 57 | all5.3: liblua5.3-openssl |
| 77 | 58 | all: $(foreach API,$(strip $(LUA_APIS)),all$(API)) | |
| 78 | all: all5.1 all5.2 | ||
| 79 | 59 | ||
| 80 | endif | 60 | endif |
| 81 | 61 | ||
| @@ -85,8 +65,6 @@ endif | |||
| 85 | # | 65 | # |
| 86 | define INSTALL_$(d) | 66 | define INSTALL_$(d) |
| 87 | 67 | ||
| 88 | LUAC$(1)_$(d) = $$(or $$(call LUAPATH_$(d), $(1), luac), true) | ||
| 89 | |||
| 90 | MODS$(1)_$(d) = \ | 68 | MODS$(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 | 97 | liblua$(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: | |||
| 169 | endef # INSTALL_$(d) | 139 | endef # 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 | ||
| 177 | ifneq "$(filter $(abspath $(d)/..)/%, $(abspath $(firstword $(MAKEFILE_LIST))))" "" | 145 | ifneq "$(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 | ||
| 180 | install5.1: liblua5.1-openssl-install | 149 | install5.1: liblua5.1-openssl-install |
| 181 | |||
| 182 | install5.2: liblua5.2-openssl-install | 150 | install5.2: liblua5.2-openssl-install |
| 183 | |||
| 184 | install5.3: liblua5.3-openssl-install | 151 | install5.3: liblua5.3-openssl-install |
| 185 | 152 | install: $(foreach API,$(strip $(LUA_APIS)),install$(API)) | |
| 186 | install: 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 | ||
| 190 | uninstall5.1: liblua5.1-openssl-uninstall | 156 | uninstall5.1: liblua5.1-openssl-uninstall |
| 191 | |||
| 192 | uninstall5.2: liblua5.2-openssl-uninstall | 157 | uninstall5.2: liblua5.2-openssl-uninstall |
| 193 | |||
| 194 | uninstall5.3: liblua5.3-openssl-uninstall | 158 | uninstall5.3: liblua5.3-openssl-uninstall |
| 195 | 159 | uninstall: $(foreach API,$(strip $(LUA_APIS)),uninstall$(API)) | |
| 196 | uninstall: uninstall5.1 uninstall5.2 | ||
| 197 | 160 | ||
| 198 | endif | 161 | endif |
| 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 "" |
