diff options
| author | william <william@25tandclement.com> | 2013-12-09 21:05:17 -0800 |
|---|---|---|
| committer | william <william@25tandclement.com> | 2013-12-09 21:05:17 -0800 |
| commit | fbd452885694da66156e95f671ab364cfe157bef (patch) | |
| tree | 0c9f0752ef7ff5693447ccfd64c1e4800a961fc7 /GNUmakefile | |
| parent | d4aa420319bff15a6f84f679c6374dda7cf1b0f2 (diff) | |
| download | luaossl-fbd452885694da66156e95f671ab364cfe157bef.tar.gz luaossl-fbd452885694da66156e95f671ab364cfe157bef.tar.bz2 luaossl-fbd452885694da66156e95f671ab364cfe157bef.zip | |
copy over build files from cqueues
Diffstat (limited to 'GNUmakefile')
| -rw-r--r-- | GNUmakefile | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..33903f8 --- /dev/null +++ b/GNUmakefile | |||
| @@ -0,0 +1,193 @@ | |||
| 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 | all: # default target | ||
| 11 | |||
| 12 | |||
| 13 | # | ||
| 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 | ||
| 15 | # | ||
| 16 | -include $(d)/.config | ||
| 17 | |||
| 18 | prefix ?= /usr/local | ||
| 19 | includedir ?= $(prefix)/include | ||
| 20 | libdir ?= $(prefix)/lib | ||
| 21 | datadir ?= $(prefix)/share | ||
| 22 | bindir ?= $(prefix)/bin | ||
| 23 | lua51cpath ?= $(libdir)/lua/5.1 | ||
| 24 | lua51path ?= $(datadir)/lua/5.1 | ||
| 25 | lua52cpath ?= $(libdir)/lua/5.2 | ||
| 26 | lua52path ?= $(datadir)/lua/5.2 | ||
| 27 | |||
| 28 | AR ?= ar | ||
| 29 | RANLIB ?= ranlib | ||
| 30 | M4 ?= m4 | ||
| 31 | RM ?= rm | ||
| 32 | CP ?= cp | ||
| 33 | RMDIR ?= rmdir | ||
| 34 | MKDIR ?= mkdir | ||
| 35 | CHMOD ?= chmod | ||
| 36 | INSTALL ?= install | ||
| 37 | INSTALL_DATA ?= $(INSTALL) -m 644 | ||
| 38 | |||
| 39 | .PHONY: $(d)/config | ||
| 40 | |||
| 41 | $(d)/config: | ||
| 42 | printf 'prefix ?= $(value prefix)'"\n" >| $(@D)/.config | ||
| 43 | printf 'includedir ?= $(value includedir)'"\n" >> $(@D)/.config | ||
| 44 | printf 'libdir ?= $(value libdir)'"\n" >> $(@D)/.config | ||
| 45 | printf 'datadir ?= $(value datadir)'"\n" >> $(@D)/.config | ||
| 46 | printf 'bindir ?= $(value bindir)'"\n" >> $(@D)/.config | ||
| 47 | printf 'lua51cpath ?= $(value lua51cpath)'"\n" >> $(@D)/.config | ||
| 48 | printf 'lua51path ?= $(value lua51path)'"\n" >> $(@D)/.config | ||
| 49 | printf 'lua52cpath ?= $(value lua52cpath)'"\n" >> $(@D)/.config | ||
| 50 | printf 'lua52path ?= $(value lua52path)'"\n" >> $(@D)/.config | ||
| 51 | printf 'CC ?= $(CC)'"\n" >> $(@D)/.config | ||
| 52 | printf 'CPPFLAGS ?= $(value CPPFLAGS)'"\n" >> $(@D)/.config | ||
| 53 | printf 'CFLAGS ?= $(value CFLAGS)'"\n" >> $(@D)/.config | ||
| 54 | printf 'LDFLAGS ?= $(value LDFLAGS)'"\n" >> $(@D)/.config | ||
| 55 | printf 'SOFLAGS ?= $(value SOFLAGS)'"\n" >> $(@D)/.config | ||
| 56 | printf 'AR ?= $(value AR)'"\n" >> $(@D)/.config | ||
| 57 | printf 'RANLIB ?= $(value RANLIB)'"\n" >> $(@D)/.config | ||
| 58 | printf 'M4 ?= $(value M4)'"\n" >> $(@D)/.config | ||
| 59 | printf 'RM ?= $(value RM)'"\n" >> $(@D)/.config | ||
| 60 | printf 'CP ?= $(value CP)'"\n" >> $(@D)/.config | ||
| 61 | printf 'RMDIR ?= $(value RMDIR)'"\n" >> $(@D)/.config | ||
| 62 | printf 'MKDIR ?= $(value MKDIR)'"\n" >> $(@D)/.config | ||
| 63 | printf 'CHMOD ?= $(value CHMOD)'"\n" >> $(@D)/.config | ||
| 64 | printf 'INSTALL ?= $(value INSTALL)'"\n" >> $(@D)/.config | ||
| 65 | printf 'INSTALL_DATA ?= $(value INSTALL_DATA)'"\n" >> $(@D)/.config | ||
| 66 | |||
| 67 | # add local targets if building from inside project tree | ||
| 68 | ifneq "$(filter $(abspath $(d)/..)/%, $(abspath $(firstword $(MAKEFILE_LIST))))" "" | ||
| 69 | .PHONY: config configure | ||
| 70 | |||
| 71 | config configure: $(d)/config | ||
| 72 | endif | ||
| 73 | |||
| 74 | |||
| 75 | # | ||
| 76 | # S H A R E D C O M P I L A T I O N F L A G S | ||
| 77 | # | ||
| 78 | cc-option ?= $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ | ||
| 79 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;) | ||
| 80 | |||
| 81 | VENDOR_OS_$(d) := $(shell $(d)/mk/vendor.os) | ||
| 82 | VENDOR_CC_$(d) := $(shell env CC="$(CC)" $(d)/mk/vendor.cc) | ||
| 83 | |||
| 84 | ifneq ($(VENDOR_OS_$(d)), OpenBSD) | ||
| 85 | CPPFLAGS_$(d) += -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE | ||
| 86 | endif | ||
| 87 | |||
| 88 | ifeq ($(VENDOR_OS_$(d)), SunOS) | ||
| 89 | CPPFLAGS_$(d) += -Usun -D_XPG4_2 -D__EXTENSIONS__ | ||
| 90 | endif | ||
| 91 | |||
| 92 | ifeq ($(VENDOR_CC_$(d)), gcc) | ||
| 93 | CFLAGS_$(d) += -O2 -std=gnu99 -fPIC | ||
| 94 | CFLAGS_$(d) += -g -Wall -Wextra $(call cc-option, -Wno-missing-field-initializers) $(call cc-option, -Wno-override-init) -Wno-unused | ||
| 95 | endif | ||
| 96 | |||
| 97 | ifeq ($(VENDOR_CC_$(d)), clang) | ||
| 98 | CFLAGS_$(d) += -O2 -std=gnu99 -fPIC | ||
| 99 | CFLAGS_$(d) += -g -Wall -Wextra -Wno-missing-field-initializers -Wno-initializer-overrides -Wno-unused | ||
| 100 | endif | ||
| 101 | |||
| 102 | ifeq ($(VENDOR_CC_$(d)), sunpro) | ||
| 103 | CFLAGS_$(d) += -xcode=pic13 | ||
| 104 | CFLAGS_$(d) += -g | ||
| 105 | endif | ||
| 106 | |||
| 107 | ifeq ($(VENDOR_OS_$(d)), Darwin) | ||
| 108 | CFLAGS_$(d) += -Wno-deprecated-declarations | ||
| 109 | endif | ||
| 110 | |||
| 111 | ifeq ($(VENDOR_OS_$(d)), Darwin) | ||
| 112 | SOFLAGS_$(d) += -bundle -undefined dynamic_lookup | ||
| 113 | else | ||
| 114 | SOFLAGS_$(d) += -shared | ||
| 115 | endif | ||
| 116 | |||
| 117 | |||
| 118 | # | ||
| 119 | # P R O J E C T R U L E S | ||
| 120 | # | ||
| 121 | include $(d)/src/GNUmakefile | ||
| 122 | |||
| 123 | |||
| 124 | # | ||
| 125 | # C L E A N R U L E S | ||
| 126 | # | ||
| 127 | .PHONY: $(d)/clean~ clean~ | ||
| 128 | |||
| 129 | $(d)/clean~: | ||
| 130 | $(RM) -f $(@D)/*~ | ||
| 131 | |||
| 132 | clean~: $(d)/clean~ | ||
| 133 | |||
| 134 | |||
| 135 | # | ||
| 136 | # D E B I A N R U L E S | ||
| 137 | # | ||
| 138 | ifneq "$(filter $(abspath $(d))/%, $(abspath $(firstword $(MAKEFILE_LIST))))" "" | ||
| 139 | |||
| 140 | DPKG_BUILDPACKAGE ?= dpkg-buildpackage | ||
| 141 | FAKEROOT ?= fakeroot | ||
| 142 | DPKG_BUILDPACKAGE_OPTIONS ?= -b -uc -us | ||
| 143 | |||
| 144 | .PHONY: $(d)/debian $(d)/debian-clean debian deb debian-clean deb-clean | ||
| 145 | |||
| 146 | $(d)/debian: | ||
| 147 | cd $(@D) && $(DPKG_BUILDPACKAGE) -rfakeroot $(DPKG_BUILDPACKAGE_OPTIONS) | ||
| 148 | |||
| 149 | $(d)/debian-clean: | ||
| 150 | cd $(@D) && $(FAKEROOT) ./debian/rules clean | ||
| 151 | |||
| 152 | debian deb: $(d)/debian | ||
| 153 | |||
| 154 | debian-clean deb-clean: $(d)/debian-clean | ||
| 155 | |||
| 156 | endif # debian guard | ||
| 157 | |||
| 158 | |||
| 159 | # | ||
| 160 | # R E D H A T R U L E S | ||
| 161 | # | ||
| 162 | ifneq "$(filter $(abspath $(d))/%, $(abspath $(firstword $(MAKEFILE_LIST))))" "" | ||
| 163 | .PHONY: $(d)/redhat $(d)/redhat-clean redhat rpm redhat-clean rpm-clean | ||
| 164 | |||
| 165 | redhat rpm: $(d)/redhat | ||
| 166 | |||
| 167 | redhat-clean rpm-clean: $(d)/redhat-clean | ||
| 168 | |||
| 169 | endif # redhat guard | ||
| 170 | |||
| 171 | |||
| 172 | # | ||
| 173 | # R E L E A S E T A R B A L L R U L E S | ||
| 174 | # | ||
| 175 | ifneq "$(filter $(abspath $(d))/%, $(abspath $(firstword $(MAKEFILE_LIST))))" "" | ||
| 176 | |||
| 177 | LUAOSSL_VERSION := $(shell $(d)/mk/changelog version) | ||
| 178 | |||
| 179 | .PHONY: $(d)/luaossl-$(LUAOSSL_VERSION).tgz release | ||
| 180 | |||
| 181 | $(d)/luaossl-$(LUAOSSL_VERSION).tgz: | ||
| 182 | cd $(@D) && git archive --format=tar --prefix=$(basename $(@F))/ HEAD | gzip -c > $@ | ||
| 183 | |||
| 184 | release: $(d)/luaossl-$(LUAOSSL_VERSION).tgz | ||
| 185 | |||
| 186 | endif # release guard | ||
| 187 | |||
| 188 | |||
| 189 | endif # include guard | ||
| 190 | |||
| 191 | # non-recursive epilogue | ||
| 192 | d := $(dirstack_$(sp)) | ||
| 193 | sp := $(basename $(sp)) | ||
