diff options
| author | William Ahern <william@server.local> | 2013-12-09 20:56:25 -0800 |
|---|---|---|
| committer | William Ahern <william@server.local> | 2013-12-09 20:56:25 -0800 |
| commit | d4aa420319bff15a6f84f679c6374dda7cf1b0f2 (patch) | |
| tree | b716502f27733e5dd9d2e45715a00bf88586e12e /src/GNUmakefile | |
| parent | e42cc7815ff3c948c4ab4e2782da2a2cb4f476bf (diff) | |
| download | luaossl-d4aa420319bff15a6f84f679c6374dda7cf1b0f2.tar.gz luaossl-d4aa420319bff15a6f84f679c6374dda7cf1b0f2.tar.bz2 luaossl-d4aa420319bff15a6f84f679c6374dda7cf1b0f2.zip | |
move newly split files into src/ directory
Diffstat (limited to 'src/GNUmakefile')
| -rw-r--r-- | src/GNUmakefile | 214 |
1 files changed, 214 insertions, 0 deletions
diff --git a/src/GNUmakefile b/src/GNUmakefile new file mode 100644 index 0000000..fcf79a6 --- /dev/null +++ b/src/GNUmakefile | |||
| @@ -0,0 +1,214 @@ | |||
| 1 | # non-recursive prologue | ||
| 2 | sp := $(sp).x | ||
| 3 | dirstack_$(sp) := $(d) | ||
| 4 | d := $(abspath $(lastword $(MAKEFILE_LIST))/..) | ||
| 5 | |||
| 6 | ifeq ($(origin GUARD_$(d)), undefined) | ||
| 7 | GUARD_$(d) := 1 | ||
| 8 | |||
| 9 | |||
| 10 | # | ||
| 11 | # E N V I R O N M E N T C O N F I G U R A T I O N | ||
| 12 | # | ||
| 13 | include $(d)/../GNUmakefile | ||
| 14 | |||
| 15 | |||
| 16 | # | ||
| 17 | # C O M P I L A T I O N F L A G S | ||
| 18 | # | ||
| 19 | OS_$(d) = $(shell $(d)/../mk/vendor.os) | ||
| 20 | CC_$(d) = $(shell $(d)/../mk/vendor.cc) | ||
| 21 | LUAPATH_$(d) = $(shell env CC="$(CC)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(<D)/../mk/lua.path -krxm3 -I$(DESTDIR)$(includedir) -I/usr/include -I/usr/local/include -P$(DESTDIR)$(bindir) -P$(bindir) -L$(DESTDIR)$(libdir) -L$(libdir) -v$(1) $(2)) | ||
| 22 | |||
| 23 | CPPFLAGS_$(d) = $(CPPFLAGS_$(abspath $(@D)/../..)) | ||
| 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 | ||
| 33 | |||
| 34 | # | ||
| 35 | # C O M P I L A T I O N R U L E S | ||
| 36 | # | ||
| 37 | |||
| 38 | define BUILD_$(d) | ||
| 39 | |||
| 40 | .SECONDARY: liblua$(1)-openssl openssl$(1) | ||
| 41 | |||
| 42 | $$(d)/$(1)/openssl.so: $$(d)/$(1)/openssl.o | ||
| 43 | $$(CC) -o $$@ $$^ $$(SOFLAGS_$$(abspath $$(@D)/..)) $$(SOFLAGS) $$(LDFLAGS_$$(abspath $$(@D)/..)) $$(LDFLAGS) | ||
| 44 | |||
| 45 | $$(d)/$(1)/openssl.o: $$(d)/openssl.c $$(d)/compat52.h | ||
| 46 | test "$$(notdir $$(@D))" = "$$(call LUAPATH_$$(<D), $$(notdir $$(@D)), version)" | ||
| 47 | $$(MKDIR) -p $$(@D) | ||
| 48 | $$(CC) $$(CFLAGS_$$(<D)) $$(CFLAGS) $$(call LUAPATH_$$(<D), $$(notdir $$(@D)), cppflags) $$(CPPFLAGS_$$(<D)) $$(CPPFLAGS) -c -o $$@ $$< | ||
| 49 | |||
| 50 | liblua$(1)-openssl openssl$(1): $$(d)/$(1)/openssl.so | ||
| 51 | |||
| 52 | endef # BUILD_$(d) | ||
| 53 | |||
| 54 | $(eval $(call BUILD_$(d),5.1)) | ||
| 55 | |||
| 56 | $(eval $(call BUILD_$(d),5.2)) | ||
| 57 | |||
| 58 | ifneq "$(filter $(abspath $(d)/..)/%, $(abspath $(firstword $(MAKEFILE_LIST))))" "" | ||
| 59 | .SECONDARY: all5.1 all5.2 all | ||
| 60 | |||
| 61 | all5.1: liblua5.1-openssl | ||
| 62 | |||
| 63 | all5.2: liblua5.2-openssl | ||
| 64 | |||
| 65 | all: all5.1 all5.2 | ||
| 66 | |||
| 67 | endif | ||
| 68 | |||
| 69 | |||
| 70 | # | ||
| 71 | # I N S T A L L & U N I N S T A L L R U L E S | ||
| 72 | # | ||
| 73 | define INSTALL_$(d) | ||
| 74 | |||
| 75 | LUAC$(1)_$(d) = $$(or $$(call LUAPATH_$(d), $(1), luac), true) | ||
| 76 | |||
| 77 | MODS$(1)_$(d) = \ | ||
| 78 | $$(DESTDIR)$(2)/_openssl.so \ | ||
| 79 | $$(DESTDIR)$(3)/openssl/bignum.lua \ | ||
| 80 | $$(DESTDIR)$(3)/openssl/pubkey.lua \ | ||
| 81 | $$(DESTDIR)$(3)/openssl/x509.lua \ | ||
| 82 | $$(DESTDIR)$(3)/openssl/x509/name.lua \ | ||
| 83 | $$(DESTDIR)$(3)/openssl/x509/altname.lua \ | ||
| 84 | $$(DESTDIR)$(3)/openssl/x509/chain.lua \ | ||
| 85 | $$(DESTDIR)$(3)/openssl/x509/store.lua \ | ||
| 86 | $$(DESTDIR)$(3)/openssl/ssl/context.lua \ | ||
| 87 | $$(DESTDIR)$(3)/openssl/ssl.lua \ | ||
| 88 | $$(DESTDIR)$(3)/openssl/digest.lua \ | ||
| 89 | $$(DESTDIR)$(3)/openssl/hmac.lua \ | ||
| 90 | $$(DESTDIR)$(3)/openssl/cipher.lua \ | ||
| 91 | $$(DESTDIR)$(3)/openssl/rand.lua | ||
| 92 | |||
| 93 | .SECONDARY: liblua$(1)-openssl-install openssl$(1)-install | ||
| 94 | |||
| 95 | $$(DESTDIR)$(2)/_openssl.so: $$(d)/$(1)/openssl.so | ||
| 96 | $$(MKDIR) -p $$(@D) | ||
| 97 | $$(CP) -p $$< $$@ | ||
| 98 | |||
| 99 | $$(DESTDIR)$(3)/openssl/%.lua: $$(d)/openssl.%.lua | ||
| 100 | $$(LUAC$(1)_$(d)) -p $$< | ||
| 101 | $$(MKDIR) -p $$(@D) | ||
| 102 | $$(CP) -p $$< $$@ | ||
| 103 | |||
| 104 | $$(DESTDIR)$(3)/openssl/x509/%.lua: $$(d)/openssl.x509.%.lua | ||
| 105 | $$(LUAC$(1)_$(d)) -p $$< | ||
| 106 | $$(MKDIR) -p $$(@D) | ||
| 107 | $$(CP) -p $$< $$@ | ||
| 108 | |||
| 109 | $$(DESTDIR)$(3)/openssl/ssl/%.lua: $$(d)/openssl.ssl.%.lua | ||
| 110 | $$(LUAC$(1)_$(d)) -p $$< | ||
| 111 | $$(MKDIR) -p $$(@D) | ||
| 112 | $$(CP) -p $$< $$@ | ||
| 113 | |||
| 114 | $$(DESTDIR)$(3)/openssl/ssl/%.lua: $$(d)/openssl.ssl.%.lua | ||
| 115 | $$(LUAC$(1)_$(d)) -p $$< | ||
| 116 | $$(MKDIR) -p $$(@D) | ||
| 117 | $$(CP) -p $$< $$@ | ||
| 118 | |||
| 119 | liblua$(1)-openssl-install openssl$(1)-install: $$(MODS$(1)_$$(d)) | ||
| 120 | |||
| 121 | .PHONY: liblua$(1)-openssl-uninstall openssl$(1)-uninstall | ||
| 122 | |||
| 123 | liblua$(1)-openssl-uninstall openssl$(1)-uninstall: | ||
| 124 | $$(RM) -f $$(MODS$(1)_$(d)) | ||
| 125 | -$$(RMDIR) $$(DESTDIR)$(3)/openssl/x509 | ||
| 126 | -$$(RMDIR) $$(DESTDIR)$(3)/openssl/ssl | ||
| 127 | -$$(RMDIR) $$(DESTDIR)$(3)/openssl | ||
| 128 | |||
| 129 | endef # INSTALL_$(d) | ||
| 130 | |||
| 131 | $(eval $(call INSTALL_$(d),5.1,$$(lua51cpath),$$(lua51path))) | ||
| 132 | |||
| 133 | $(eval $(call INSTALL_$(d),5.2,$$(lua52cpath),$$(lua52path))) | ||
| 134 | |||
| 135 | ifneq "$(filter $(abspath $(d)/..)/%, $(abspath $(firstword $(MAKEFILE_LIST))))" "" | ||
| 136 | .SECONDARY: install5.1 install5.2 install | ||
| 137 | |||
| 138 | install5.1: liblua5.1-openssl-install | ||
| 139 | |||
| 140 | install5.2: liblua5.2-openssl-install | ||
| 141 | |||
| 142 | install: install5.1 install5.2 | ||
| 143 | |||
| 144 | .PHONY: uninstall5.1 uninstall5.2 uninstall | ||
| 145 | |||
| 146 | uninstall5.1: liblua5.1-openssl-uninstall | ||
| 147 | |||
| 148 | uninstall5.2: liblua5.2-openssl-uninstall | ||
| 149 | |||
| 150 | uninstall: uninstall5.1 uninstall5.2 | ||
| 151 | |||
| 152 | endif | ||
| 153 | |||
| 154 | |||
| 155 | # | ||
| 156 | # C L E A N R U L E S | ||
| 157 | # | ||
| 158 | .PHONY: $(d)/clean $(d)/clean~ clean clean~ | ||
| 159 | |||
| 160 | $(d)/clean: | ||
| 161 | $(RM) -fr $(@D)/*.so $(@D)/*.o $(@D)/*.dSYM $(@D)/5.1 $(@D)/5.2 | ||
| 162 | |||
| 163 | $(d)/clean~: $(d)/clean | ||
| 164 | $(RM) -f $(@D)/*~ | ||
| 165 | |||
| 166 | clean: $(d)/clean | ||
| 167 | |||
| 168 | clean~: $(d)/clean~ | ||
| 169 | |||
| 170 | |||
| 171 | # | ||
| 172 | # H E L P R U L E S | ||
| 173 | # | ||
| 174 | .PHONY: $(d)/help help | ||
| 175 | |||
| 176 | $(d)/help: | ||
| 177 | @echo | ||
| 178 | @echo "ext/ targets:" | ||
| 179 | @echo "" | ||
| 180 | @echo " all - build all binary targets" | ||
| 181 | @echo "openssl - invokes openssl5.1 and openssl5.2" | ||
| 182 | @echo "openssl5.1 - build 5.1/openssl.so" | ||
| 183 | @echo "openssl5.2 - build 5.2/openssl.so" | ||
| 184 | @echo "install - invokes install5.1 and install5.2" | ||
| 185 | @echo "install5.1 - install openssl Lua 5.1 modules" | ||
| 186 | @echo "install5.2 - install openssl Lua 5.2 modules" | ||
| 187 | @echo "uninstall - invokes uninstall5.1 and uninstall5.2" | ||
| 188 | @echo "uninstall5.1 - uninstall openssl Lua 5.1 modules" | ||
| 189 | @echo "uninstall5.2 - uninstall openssl Lua 5.2 modules" | ||
| 190 | @echo " clean - rm binary targets, object files, debugging symbols, etc" | ||
| 191 | @echo " clean~ - clean + rm *~" | ||
| 192 | @echo " help - echo this help message" | ||
| 193 | @echo "" | ||
| 194 | @echo "Some important Make variables:" | ||
| 195 | @echo "" | ||
| 196 | @echo " prefix - path to install root" | ||
| 197 | @echo ' lua51path - install path for Lua 5.1 modules ($$(lua51path))' | ||
| 198 | @echo 'lua51cpath - install path for Lua 5.1 C modules ($$(lua51cpath))' | ||
| 199 | @echo ' lua52path - install path for Lua 5.1 modules ($$(lua51path))' | ||
| 200 | @echo 'lua52cpath - install path for Lua 5.1 C modules ($$(lua51cpath))' | ||
| 201 | @echo "" | ||
| 202 | @echo "(NOTE: all the common GNU-style paths are supported, including" | ||
| 203 | @echo "prefix, bindir, libdir, datadir, includedir, and DESTDIR.)" | ||
| 204 | @echo "" | ||
| 205 | @echo "Report bugs to <william@25thandClement.com>" | ||
| 206 | |||
| 207 | help: $(d)/help | ||
| 208 | |||
| 209 | |||
| 210 | endif # include guard | ||
| 211 | |||
| 212 | # non-recursive epilogue | ||
| 213 | d := $(dirstack_$(sp)) | ||
| 214 | sp := $(basename $(sp)) | ||
