aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md39
-rw-r--r--rules/32.mk4
-rw-r--r--rules/64.mk4
-rw-r--r--rules/autotools.mk9
-rw-r--r--rules/common.mk22
5 files changed, 55 insertions, 23 deletions
diff --git a/README.md b/README.md
index 1bcf0e6..a6fccd0 100644
--- a/README.md
+++ b/README.md
@@ -31,10 +31,11 @@ and it should not be included directly, unless you are doing something really sp
### Targets provided by common.mk
-All targets (but `clean`) provided by this module are abstract and do nothing. Other modules extend
-these targets. Each target has its annex `target-stamp` which does
-the real job. Each `*-stamp` is a file created with `touch` command. All internal
-dependencies are implemented through these "stamps", but developer can use basename
+All targets (but `clean`) provided by this module are abstract and
+do nothing. Other modules extend these targets. Each target has
+its annex `target-stamp` which does the real job. Each `*-stamp` is
+a file created with `touch` command. All internal dependencies are
+implemented through these "stamps", but developer can use basename
for target, e. g. `make unpack` instead of `make unpack-stamp`.
Meaning of these targets depends on other included modules:
@@ -44,7 +45,6 @@ Meaning of these targets depends on other included modules:
* `configure` - configure sources, e. g. execute GNU configure or CMake,
* `build` - build sources, e. g. compile with C compiler,
* `install` - install files into proto directory.
-* `clean` - remove all stamps and working directory (`./work` by default)
Each target in the list above depends on previous target. Yes, except `clean`.
@@ -55,6 +55,35 @@ and by default it is:
rm -f *-stamp
rm -rf $(workdir)
+### Building many variants
+
+`common.mk` defines a macro `add-variant` to extend above targets and to define
+related variables such as `protodir.<variant>`. Calling `$(eval $(call add-variant,FOO))`
+will add dependencies to configure-stamp, build-stamp,install-stamp and define
+extra variables:
+
+ variants += FOO
+ protodir.FOO = $(workdir)/proto/FOO
+ builddir.FOO = $(workdir)/build/FOO
+
+ configure-stamp : configure-FOO-stamp
+ build-stamp : build-FOO-stamp
+ install-stamp : install-FOO-stamp
+ %-FOO-stamp: variant = FOO
+
+
+The `add-variant` macro is used by `32.mk` and `64.mk` modules for
+building 32-bit or 64-bit packages. You may want to use it for any
+other purpose, e. g. to compile Curl with OpenSSL or with GNU TLS.
+Standard modules, such as `autotools.mk`, take care of every variant defined.
+You can tune building by defining variables like `configure-options.FOO`, e. g.:
+
+ $(eval $(call add-variant,ssl))
+ $(eval $(call add-variant,gnu))
+
+ configure-options.gnu = --without-ssl --with-gnutls
+ configure-options.ssl = --with-ssl --without-gnutls
+
## ips.mk
diff --git a/rules/32.mk b/rules/32.mk
index cb94b2a..a504c24 100644
--- a/rules/32.mk
+++ b/rules/32.mk
@@ -27,10 +27,6 @@ include /usr/share/cibs/rules/common.mk
$(eval $(call add-variant,32))
-build-stamp : build-32-stamp
-configure-stamp : configure-32-stamp
-install-stamp : install-32-stamp
-
%-32-stamp: bits = 32
# build32 = \#, not it is emtpy and lines like
diff --git a/rules/64.mk b/rules/64.mk
index f6b0349..5056969 100644
--- a/rules/64.mk
+++ b/rules/64.mk
@@ -27,10 +27,6 @@ include /usr/share/cibs/rules/common.mk
$(eval $(call add-variant,64))
-build-stamp : build-64-stamp
-configure-stamp : configure-64-stamp
-install-stamp : install-64-stamp
-
%-64-stamp: bits = 64
# build64 = \#, not it is emtpy and lines like
diff --git a/rules/autotools.mk b/rules/autotools.mk
index fd59ff3..bec3042 100644
--- a/rules/autotools.mk
+++ b/rules/autotools.mk
@@ -34,10 +34,10 @@ configure-env = \
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
CPPFLAGS="$(CPPFLAGS)" \
+ $(configure-env.$(variant)) \
configure-options = \
- $(configure-options.$(bits)) \
--prefix="$(prefix)" \
--libdir="$(libdir)" \
--bindir="$(bindir)" \
@@ -45,20 +45,21 @@ configure-options = \
--infodir=/usr/share/info \
--mandir=\$${prefix}/share/man \
--localstatedir=/var \
+ $(configure-options.$(variant)) \
-configure-%-stamp: pre-configure-stamp
+configure-%-stamp:
[ -d "$(builddir)" ] || mkdir -p "$(builddir)"
cd "$(builddir)" && \
env $(configure-env) \
$(configure) $(configure-options)
touch $@
-build-%-stamp: configure-%-stamp
+build-%-stamp:
cd "$(builddir)" && $(MAKE) $(make-jobs:%=-j%)
touch $@
-install-%-stamp: build-%-stamp
+install-%-stamp:
cd "$(builddir)" && $(MAKE) install DESTDIR="$(protodir)"
touch $@
diff --git a/rules/common.mk b/rules/common.mk
index 86bbef0..7358500 100644
--- a/rules/common.mk
+++ b/rules/common.mk
@@ -51,7 +51,19 @@ protodir-base.$1 = $(workdir-base)/proto/$1
builddir-base.$1 = $(workdir-base)/build/$1
protodir.$1 = $(workdir)/proto/$1
builddir.$1 = $(workdir)/build/$1
+
+configure-stamp : configure-$1-stamp
+build-stamp : build-$1-stamp
+install-stamp : install-$1-stamp
+
+configure-$1-stamp : pre-configure-stamp
+build-$1-stamp : configure-$1-stamp
+install-$1-stamp : build-$1-stamp
+
variants += $1
+
+%-$1-stamp: variant = $1
+
endef
@@ -69,11 +81,9 @@ libdir.32 = $(prefix)/lib/$(mach32)
libdir.64 = $(prefix)/lib/$(mach64)
bindir.32 = $(prefix)/bin
bindir.64 = $(prefix)/bin
-includedir.32 = /usr/include
-includedir.64 = /usr/include
+includedir = /usr/include
libdir.noarch = $(prefix)/lib
bindir.noarch = $(prefix)/bin
-includedir.noarch = /usr/include
PKG_CONFIG_PATH.32 = /usr/gnu/lib/$(mach32)/pkg-config:/usr/lib/$(mach32)/pkg-config
PKG_CONFIG_PATH.64 = /usr/gnu/lib/$(mach64)/pkg-config:/usr/lib/$(mach64)/pkg-config
@@ -82,11 +92,11 @@ export PKG_CONFIG_PATH = PKG_CONFIG_PATH.$(bits)
# $(bits) are target-specific and defined in 32.mk or 64.mk
bindir = $(bindir.$(bits))
libdir = $(libdir.$(bits))
-includedir = $(includedir.$(bits))
CC = $(CC.$(bits))
CXX = $(CXX.$(bits))
-builddir = $(builddir.$(bits))
-protodir = $(protodir.$(bits))
+
+builddir = $(builddir.$(variant))
+protodir = $(protodir.$(variant))