comparison Makefile @ 2971:7145a94e4f4e

build autoconf, automake, libtool, and cmake instead of expecting them to exist
author John W. Eaton <jwe@octave.org>
date Tue, 05 Feb 2013 15:41:22 -0500
parents 1955438b24dc
children 169114e27438
comparison
equal deleted inserted replaced
2970:e111bf60ebc5 2971:7145a94e4f4e
27 27
28 PWD := $(shell pwd) 28 PWD := $(shell pwd)
29 SHELL := bash 29 SHELL := bash
30 30
31 INSTALL := $(shell ginstall --help >/dev/null 2>&1 && echo g)install 31 INSTALL := $(shell ginstall --help >/dev/null 2>&1 && echo g)install
32 LIBTOOL := $(shell glibtool --help >/dev/null 2>&1 && echo g)libtool
33 LIBTOOLIZE := $(shell glibtoolize --help >/dev/null 2>&1 && echo g)libtoolize
34 PATCH := $(shell gpatch --help >/dev/null 2>&1 && echo g)patch 32 PATCH := $(shell gpatch --help >/dev/null 2>&1 && echo g)patch
35 SED := $(shell gsed --help >/dev/null 2>&1 && echo g)sed 33 SED := $(shell gsed --help >/dev/null 2>&1 && echo g)sed
36 WGET := wget --no-check-certificate \ 34 WGET := wget --no-check-certificate \
37 --user-agent=$(shell wget --version | \ 35 --user-agent=$(shell wget --version | \
38 $(SED) -n 's,GNU \(Wget\) \([0-9.]*\).*,\1/\2,p') 36 $(SED) -n 's,GNU \(Wget\) \([0-9.]*\).*,\1/\2,p')
39 37
40 REQUIREMENTS := autoconf automake bash bison bzip2 cmake flex \ 38 REQUIREMENTS := bash bison bzip2 flex \
41 gcc intltoolize $(LIBTOOL) $(LIBTOOLIZE) \ 39 gcc intltoolize \
42 $(MAKE) openssl $(PATCH) $(PERL) pkg-config \ 40 $(MAKE) openssl $(PATCH) $(PERL) pkg-config \
43 scons $(SED) unzip wget xz yasm 41 scons $(SED) unzip wget xz yasm
42
43 LIBTOOL := libtool
44 LIBTOOLIZE := libtoolize
45 BUILD_TOOLS := build-autoconf build-automake build-cmake build-libtool
44 46
45 PREFIX := $(PWD)/usr 47 PREFIX := $(PWD)/usr
46 LOG_DIR := $(PWD)/log 48 LOG_DIR := $(PWD)/log
47 TIMESTAMP := $(shell date +%Y%m%d_%H%M%S) 49 TIMESTAMP := $(shell date +%Y%m%d_%H%M%S)
48 PKG_DIR := $(PWD)/pkg 50 PKG_DIR := $(PWD)/pkg
49 TMP_DIR = $(PWD)/tmp-$(1) 51 TMP_DIR = $(PWD)/tmp-$(1)
50 MAKEFILE := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) 52 MAKEFILE := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
51 TOP_DIR := $(patsubst %/,%,$(dir $(MAKEFILE))) 53 TOP_DIR := $(patsubst %/,%,$(dir $(MAKEFILE)))
52 PKGS := $(shell $(SED) -n 's/^.* id="\([^"]*\)-package">.*$$/\1/p' '$(TOP_DIR)/index.html') 54 PKGS := $(filter-out $(BUILD_TOOLS), $(shell $(SED) -n 's/^.* id="\([^"]*\)-package">.*$$/\1/p' '$(TOP_DIR)/index.html'))
53 PATH := $(PREFIX)/bin:$(PATH) 55 PATH := $(PREFIX)/bin:$(PATH)
54 56
55 MSYS_BASE_URL := http://sourceforge.net/projects/mingw/files/MSYS/Base 57 MSYS_BASE_URL := http://sourceforge.net/projects/mingw/files/MSYS/Base
56 MSYS_BASE_VER := 1.0.13 58 MSYS_BASE_VER := 1.0.13
57 MSYS_BASE_DIR := $(PREFIX)/../msys-base 59 MSYS_BASE_DIR := $(PREFIX)/../msys-base
121 endif 123 endif
122 124
123 .PHONY: all 125 .PHONY: all
124 all: $(PKGS) 126 all: $(PKGS)
125 127
128 $(PKGS): $(BUILD_TOOLS)
129
126 .PHONY: msys-base 130 .PHONY: msys-base
127 msys-base: $(MSYS_BASE_PACKAGES) 131 msys-base: $(MSYS_BASE_PACKAGES)
128 132
129 .PHONY: octave-forge-packages 133 .PHONY: octave-forge-packages
130 octave-forge-packages: $(OCTAVE_FORGE_PACKAGES) 134 octave-forge-packages: $(OCTAVE_FORGE_PACKAGES)
156 endef 160 endef
157 check-requirements: $(PREFIX)/installed/check-requirements 161 check-requirements: $(PREFIX)/installed/check-requirements
158 $(PREFIX)/installed/check-requirements: $(MAKEFILE) 162 $(PREFIX)/installed/check-requirements: $(MAKEFILE)
159 @echo '[check requirements]' 163 @echo '[check requirements]'
160 $(foreach REQUIREMENT,$(REQUIREMENTS),$(call CHECK_REQUIREMENT,$(REQUIREMENT))) 164 $(foreach REQUIREMENT,$(REQUIREMENTS),$(call CHECK_REQUIREMENT,$(REQUIREMENT)))
161 $(call CHECK_REQUIREMENT_VERSION,autoconf,2\.6[4-9]\|2\.[7-9][0-9])
162 $(call CHECK_REQUIREMENT_VERSION,automake,1\.[1-9][0-9]\(\.[0-9]\+\)\?)
163 @[ -d '$(PREFIX)/installed' ] || mkdir -p '$(PREFIX)/installed' 165 @[ -d '$(PREFIX)/installed' ] || mkdir -p '$(PREFIX)/installed'
164 @touch '$@' 166 @touch '$@'
165 167
166 define newline 168 define newline
167 169
171 $(SED) -n \ 173 $(SED) -n \
172 's/^.* id="\([A-Za-z0-9_+-]*\)-version">\([^<]*\)<.*$$/\1_VERSION := \2#/p' \ 174 's/^.* id="\([A-Za-z0-9_+-]*\)-version">\([^<]*\)<.*$$/\1_VERSION := \2#/p' \
173 '$(TOP_DIR)/index.html' \ 175 '$(TOP_DIR)/index.html' \
174 ))) 176 )))
175 177
178 include $(patsubst %,$(TOP_DIR)/src/%.mk,$(BUILD_TOOLS))
176 include $(patsubst %,$(TOP_DIR)/src/%.mk,$(PKGS)) 179 include $(patsubst %,$(TOP_DIR)/src/%.mk,$(PKGS))
177 180
178 .PHONY: download 181 .PHONY: download
179 download: $(addprefix download-,$(PKGS)) 182 download: $(addprefix download-,$(PKGS)) $(addprefix download-,$(BUILD_TOOLS))
180 183
181 define PKG_RULE 184 define PKG_RULE
182 .PHONY: download-$(1) 185 .PHONY: download-$(1)
183 download-$(1): $(addprefix download-,$($(1)_DEPS)) 186 download-$(1): $(addprefix download-,$($(1)_DEPS))
184 if ! $(call CHECK_PKG_ARCHIVE,$(1)); then \ 187 if ! $(call CHECK_PKG_ARCHIVE,$(1)); then \
242 ,) 245 ,)
243 [ -d '$(PREFIX)/installed' ] || mkdir -p '$(PREFIX)/installed' 246 [ -d '$(PREFIX)/installed' ] || mkdir -p '$(PREFIX)/installed'
244 touch '$(PREFIX)/installed/$(1)' 247 touch '$(PREFIX)/installed/$(1)'
245 endef 248 endef
246 $(foreach PKG,$(PKGS),$(eval $(call PKG_RULE,$(PKG),$(call TMP_DIR,$(PKG))))) 249 $(foreach PKG,$(PKGS),$(eval $(call PKG_RULE,$(PKG),$(call TMP_DIR,$(PKG)))))
250 $(foreach TOOL,$(BUILD_TOOLS),$(eval $(call PKG_RULE,$(TOOL),$(call TMP_DIR,$(TOOL)))))
247 251
248 .PHONY: clean 252 .PHONY: clean
249 clean: 253 clean:
250 rm -rf $(call TMP_DIR,*) $(PREFIX)/* 254 rm -rf $(call TMP_DIR,*) $(PREFIX)/*
251 255