]> Git Repo - buildroot-mgba.git/blame - package/Makefile.autotools.in
Bump font-bh-type1 to 1.0.1
[buildroot-mgba.git] / package / Makefile.autotools.in
CommitLineData
a7e49eb2 1################################################################################
d8b55b99 2# Autotools package infrastructure
a7e49eb2 3#
d8b55b99
TP
4# This file implements an infrastructure that eases development of
5# package .mk files for autotools packages. It should be used for all
6# packages that use the autotools as their build system. Non-autotools
7# packages should use the generic infrastructure in
8# package/Makefile.package.in.
a7e49eb2 9#
d8b55b99
TP
10# See the Buildroot documentation for details on the usage of this
11# infrastructure
a7e49eb2 12#
d8b55b99
TP
13# In terms of implementation, this autotools infrastructure requires
14# the .mk file to only specify metadata informations about the
15# package: name, version, download URL, etc.
00b8456c 16#
d8b55b99
TP
17# We still allow the package .mk file to override what the different
18# steps are doing, if needed. For example, if <PKG>_BUILD_CMDS is
19# already defined, it is used as the list of commands to perform to
20# build the package, instead of the default autotools behaviour. The
21# package can also define some post operation hooks.
00b8456c 22#
a7e49eb2
EA
23################################################################################
24
d58636d7 25################################################################################
d8b55b99
TP
26# AUTOTARGETS_INNER -- defines how the configuration, compilation and
27# installation of an autotools package should be done, implements a
28# few hooks to tune the build process for autotools specifities and
29# calls the generic package infrastructure to generate the necessary
30# make targets
d58636d7 31#
d8b55b99
TP
32# argument 1 is the lowercase package name
33# argument 2 is the uppercase package name, including an HOST_ prefix
34# for host packages
35# argument 3 is the uppercase package name, without the HOST_ prefix
36# for host packages
37# argument 4 is the package directory prefix
38# argument 5 is the type (target or host)
a7e49eb2
EA
39################################################################################
40
a7e49eb2
EA
41define AUTOTARGETS_INNER
42
43# define package-specific variables to default values
d8b55b99
TP
44ifndef $(2)_SUBDIR
45 ifdef $(3)_SUBDIR
46 $(2)_SUBDIR = $($(3)_SUBDIR)
47 else
48 $(2)_SUBDIR ?=
49 endif
50endif
51
a7e49eb2
EA
52$(2)_CONF_ENV ?=
53$(2)_CONF_OPT ?=
45616607 54$(2)_MAKE ?= $(MAKE)
00b8456c 55$(2)_MAKE_ENV ?=
a7e49eb2 56$(2)_MAKE_OPT ?=
d8b55b99
TP
57$(2)_AUTORECONF ?= NO
58$(2)_AUTORECONF_OPT ?=
59$(2)_LIBTOOL_PATCH ?= YES
60$(2)_USE_CONFIG_CACHE ?= $(if $(BR2_CONFIG_CACHE),YES,NO)
a7e49eb2 61$(2)_INSTALL_STAGING_OPT ?= DESTDIR=$$(STAGING_DIR) install
fedf24cf 62ifeq ($(BR2_ENABLE_DEBUG),y)
a7e49eb2 63$(2)_INSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) install-exec
fedf24cf
PK
64else
65$(2)_INSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) install-strip
66endif
a7e49eb2
EA
67$(2)_CLEAN_OPT ?= clean
68$(2)_UNINSTALL_STAGING_OPT ?= DESTDIR=$$(STAGING_DIR) uninstall
69$(2)_UNINSTALL_TARGET_OPT ?= DESTDIR=$$(TARGET_DIR) uninstall
a7e49eb2 70
d8b55b99 71$(2)_SRCDIR = $$($(2)_DIR)/$($(2)_SUBDIR)
a7e49eb2 72
d8b55b99
TP
73#
74# Configure step. Only define it if not already defined by the package
75# .mk file. And take care of the differences between host and target
76# packages.
77#
78ifndef $(2)_CONFIGURE_CMDS
79ifeq ($(5),target)
80
81# Configure package for target
82define $(2)_CONFIGURE_CMDS
83 (cd $$($$(PKG)_SRCDIR) && rm -rf config.cache && \
84 $$(TARGET_CONFIGURE_OPTS) \
85 $$(TARGET_CONFIGURE_ARGS) \
86 $$(TARGET_CONFIGURE_ENV) \
87 $$($$(PKG)_CONF_ENV) \
88 ./configure \
89 $(if $(filter YES,$$($$(PKG)_USE_CONFIG_CACHE)),--cache-file="$(BUILD_DIR)/tgt-config.cache",) \
90 --target=$$(GNU_TARGET_NAME) \
91 --host=$$(GNU_TARGET_NAME) \
92 --build=$$(GNU_HOST_NAME) \
93 --prefix=/usr \
94 --exec-prefix=/usr \
95 --sysconfdir=/etc \
96 $$(DISABLE_DOCUMENTATION) \
97 $$(DISABLE_NLS) \
98 $$(DISABLE_LARGEFILE) \
99 $$(DISABLE_IPV6) \
100 $$(QUIET) $$($$(PKG)_CONF_OPT) \
101 )
102endef
103else
a7e49eb2 104
d8b55b99
TP
105# Configure package for host
106define $(2)_CONFIGURE_CMDS
107 (cd $$($$(PKG)_SRCDIR) && rm -rf config.cache; \
108 $$(HOST_CONFIGURE_OPTS) \
109 CFLAGS="$$(HOST_CFLAGS)" \
110 LDFLAGS="$$(HOST_LDFLAGS)" \
111 ./configure \
112 --prefix="$$(HOST_DIR)/usr" \
113 --sysconfdir="$$(HOST_DIR)/etc" \
114 $$($$(PKG)_CONF_OPT) \
115 )
116endef
117endif
118endif
a7e49eb2 119
d8b55b99
TP
120#
121# Hook to update config.sub and config.guess if needed
122#
123define UPDATE_CONFIG_HOOK
124 for file in config.guess config.sub; do \
125 for i in $$$$(find $$(@D) -name $$$$file); do \
126 cp package/gnuconfig/$$$$file $$$$i; \
127 done; \
128 done
129endef
00b8456c 130
d8b55b99
TP
131ifeq ($(BR2_UPDATE_CONFIG),y)
132$(2)_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
a7e49eb2
EA
133endif
134
d8b55b99
TP
135#
136# Hook to patch libtool to make it work properly for cross-compilation
137#
138define LIBTOOL_PATCH_HOOK
139 @$(call MESSAGE,"Patching libtool")
140 $(Q)if test "$$($$(PKG)_LIBTOOL_PATCH)" = "YES" -a \
141 "$$($$(PKG)_AUTORECONF)" != "YES"; then \
142 for i in `find $$($$(PKG)_SRCDIR) -name ltmain.sh`; do \
073af428 143 toolchain/patch-kernel.sh $$$${i%/*} package buildroot-libtool.patch; \
d8b55b99
TP
144 done \
145 fi
146endef
a7e49eb2 147
073af428
PK
148# default values are not evaluated yet, so don't rely on this defaulting to YES
149ifneq ($($(2)_LIBTOOL_PATCH),NO)
d8b55b99
TP
150$(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
151endif
a7e49eb2 152
d8b55b99
TP
153#
154# Hook to autoreconf the package if needed
155#
156define AUTORECONF_HOOK
157 @$(call MESSAGE,"Autoreconfiguring")
158 $(Q)cd $$($$(PKG)_SRCDIR) && $(AUTORECONF) $$($$(PKG)_AUTORECONF_OPT)
159 $(Q)if test "$($$(PKG)_LIBTOOL_PATCH)" = "YES"; then \
160 for i in `find $$($$(PKG)_SRCDIR) -name ltmain.sh`; do \
161 toolchain/patch-kernel.sh $${i%/*} package buildroot-libtool.patch; \
162 done \
163 fi
164endef
a7e49eb2 165
d8b55b99
TP
166ifeq ($($(2)_AUTORECONF),YES)
167$(2)_POST_PATCH_HOOKS += AUTORECONF_HOOK
7d8e28cc 168$(2)_DEPENDENCIES += host-automake host-autoconf host-libtool
d8b55b99
TP
169endif
170
171#
172# Build step. Only define it if not already defined by the package .mk
173# file.
174#
175ifndef $(2)_BUILD_CMDS
176ifeq ($(5),target)
177define $(2)_BUILD_CMDS
178 $(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPT) -C $$($$(PKG)_SRCDIR)
179endef
a7e49eb2 180else
d8b55b99
TP
181define $(2)_BUILD_CMDS
182 $(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPT) -C $$($$(PKG)_SRCDIR)
183endef
184endif
a7e49eb2
EA
185endif
186
d8b55b99
TP
187#
188# Host installation step. Only define it if not already defined by the
189# package .mk file.
190#
191ifndef $(2)_INSTALL_CMDS
192define $(2)_INSTALL_CMDS
193 $(HOST_MAKE_ENV) $(MAKE) -C $$($$(PKG)_SRCDIR) install
194endef
195endif
a7e49eb2 196
d8b55b99
TP
197#
198# Staging installation step. Only define it if not already defined by
199# the package .mk file.
200#
201ifndef $(2)_INSTALL_STAGING_CMDS
202define $(2)_INSTALL_STAGING_CMDS
203 $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_STAGING_OPT) -C $$($$(PKG)_SRCDIR)
ecf5939c 204 for i in $$$$(find $(STAGING_DIR)/usr/lib* -name "*.la"); do \
d8b55b99
TP
205 cp $$$$i $$$$i~; \
206 $$(SED) "s:\(['= ]\)/usr:\\1$(STAGING_DIR)/usr:g" $$$$i; \
207 done
208endef
209endif
a7e49eb2 210
d8b55b99
TP
211#
212# Target installation step. Only define it if not already defined by
213# the package .mk file.
214#
215ifndef $(2)_INSTALL_TARGET_CMDS
216define $(2)_INSTALL_TARGET_CMDS
217 $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_INSTALL_TARGET_OPT) -C $$($$(PKG)_SRCDIR)
218endef
219endif
a7e49eb2 220
d8b55b99
TP
221#
222# Clean step. Only define it if not already defined by
223# the package .mk file.
224#
225ifndef $(2)_CLEAN_CMDS
226define $(2)_CLEAN_CMDS
227 -$$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_CLEAN_OPT) -C $$($$(PKG)_SRCDIR)
228endef
229endif
a7e49eb2 230
d8b55b99
TP
231#
232# Uninstall from staging step. Only define it if not already defined by
233# the package .mk file.
234#
235ifndef $(2)_UNINSTALL_STAGING_CMDS
236define $(2)_UNINSTALL_STAGING_CMDS
237 $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_UNINSTALL_STAGING_OPT) -C $$($$(PKG)_SRCDIR)
238endef
239endif
a7e49eb2 240
d8b55b99
TP
241#
242# Uninstall from target step. Only define it if not already defined
243# by the package .mk file.
244#
245ifndef $(2)_UNINSTALL_TARGET_CMDS
246define $(2)_UNINSTALL_TARGET_CMDS
247 $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_UNINSTALL_TARGET_OPT) -C $$($$(PKG)_SRCDIR)
248endef
249endif
a7e49eb2 250
d8b55b99
TP
251# Call the generic package infrastructure to generate the necessary
252# make targets
253$(call GENTARGETS_INNER,$(1),$(2),$(3),$(4),$(5))
a7e49eb2 254
d8b55b99 255endef
a7e49eb2 256
d8b55b99
TP
257################################################################################
258# AUTOTARGETS -- the target generator macro for autotools packages
259#
260# Argument 1 is the package directory prefix [mandatory]
261# Argument 2 is the lowercase package name [mandatory]
262# Argument 3 is "target" or "host" [optional, default: "target"]
263################################################################################
a7e49eb2 264
d8b55b99
TP
265define AUTOTARGETS
266ifeq ($(3),host)
267$(call AUTOTARGETS_INNER,$(3)-$(2),$(call UPPERCASE,$(3)-$(2)),$(call UPPERCASE,$(2)),$(1),host)
268else
269$(call AUTOTARGETS_INNER,$(2),$(call UPPERCASE,$(2)),$(call UPPERCASE,$(2)),$(1),target)
a7e49eb2
EA
270endif
271endef
This page took 0.209586 seconds and 4 git commands to generate.