1# This file is include in the sub-projects's Makefiles to inherit standard
2# build behavior.  The sub-project's Makefiles need to define NAME and
3# VERSION.  The custompatching target may by redefined to do any patching
4# just after files are unpacked from the tarball.  The postinstall target
5# may be redefined to do any post install processing.
6
7NAMEVERSION := $(NAME)-$(VERSION)
8TARBALL := $(NAMEVERSION).tar.gz
9DIR := $(OBJROOT)/$(NAMEVERSION)
10MYSRC := $(SRCROOT)/Modules/$(NAMEVERSION)
11export PATH := $(DSTROOT)/usr/bin:$(PATH)
12
13ifeq ($(shell [ -f $(DIR)/Build.PL ] && echo YES || echo NO),YES)
14PLFILE = Build.PL
15MAKECMD = ./Build
16INDIRECTPLARGS = PLBARGS
17INDIRECTMAKEARGS = BUILDARGS
18else
19PLFILE = Makefile.PL
20MAKECMD = make
21INDIRECTPLARGS = PLARGS
22INDIRECTMAKEARGS = MAKEARGS
23endif
24
25no_target: $(DIR)/.mark
26
27$(DIR)/.mark: $(DIR) configure build
28	touch $@
29
30configure: custompatching
31	@set -x && \
32	cd $(DIR) && \
33	PERL_MM_USE_DEFAULT=1 ARCHFLAGS='$(ARCHFLAGS)' $(ENV) perl $(PLFILE) $(PROJARGS) $($(INDIRECTPLARGS))
34
35build: patchafterconfigure
36	@set -x && \
37	cd $(DIR) && \
38	ARCHFLAGS='$(ARCHFLAGS)' $(ENV) $(MAKECMD) $($(INDIRECTMAKEARGS))
39
40$(DIR):
41	gnutar xozf $(TARBALL) -C $(OBJROOT)
42
43unpack: $(DIR)
44
45install: realinstall postinstall
46
47realinstall: $(DIR)/.mark
48	@set -x && \
49	cd $(DIR) && \
50	ARCHFLAGS='$(ARCHFLAGS)' $(ENV) $(MAKECMD) install $($(INDIRECTMAKEARGS))
51
52# allow custom patching before running Makefile.PL or Build.PL
53custompatching:
54
55# allow patching after running Makefile.PL or Build.PL
56patchafterconfigure:
57
58# allow post install customization
59postinstall:
60
61# whether to avoid 64-bit compiles
62no64:
63ifeq ($(NO64),YES)
64	@echo YES
65else
66	@echo NO
67endif
68