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