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)
11
12ifeq ($(shell [ -f $(DIR)/Build.PL ] && echo YES || echo NO),YES)
13PLFILE = Build.PL
14MAKECMD = perl ./Build
15INDIRECTPLARGS = PLBARGS
16INDIRECTMAKEARGS = BUILDARGS
17else
18PLFILE = Makefile.PL
19MAKECMD = make
20INDIRECTPLARGS = PLARGS
21INDIRECTMAKEARGS = MAKEARGS
22endif
23
24no_target: $(DIR)/.mark
25
26$(DIR)/.mark: $(DIR) configure build
27	touch $@
28
29configure: custompatching
30	@set -x && \
31	cd $(DIR) && \
32	PERL_MM_USE_DEFAULT=1 ARCHFLAGS='$(ARCHFLAGS)' $(ENV) perl $(PLFILE) $(PROJARGS) $($(INDIRECTPLARGS))
33
34build: patchafterconfigure
35	@set -x && \
36	cd $(DIR) && \
37	ARCHFLAGS='$(ARCHFLAGS)' $(ENV) $(MAKECMD) $($(INDIRECTMAKEARGS))
38
39$(DIR):
40	gnutar xozf $(TARBALL) -C $(OBJROOT)
41
42unpack: $(DIR)
43
44install: realinstall postinstall
45
46realinstall: $(DIR)/.mark
47	@set -x && \
48	cd $(DIR) && \
49	ARCHFLAGS='$(ARCHFLAGS)' $(ENV) $(MAKECMD) install $($(INDIRECTMAKEARGS))
50
51# allow custom patching before running Makefile.PL or Build.PL
52custompatching:
53
54# allow patching after running Makefile.PL or Build.PL
55patchafterconfigure:
56
57# allow post install customization
58postinstall:
59
60# whether to avoid 64-bit compiles
61no64:
62ifeq ($(NO64),YES)
63	@echo YES
64else
65	@echo NO
66endif
67