1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
## UB build support
##
## PROCEDURE:
##
## 1. Perform a build (let us call it arch-X).
## 2. cd into arch-X's build/ driectory.
## 3. Launch builds of the remaining architectures.
## We compute $(UB.archs.other) to be the remaining archs to build.
## The entire list is defined $(UB.archs) .
## 4. Combine other architectures into arch-X's binaries.
##
## EXAMPLE: serial method, archs: i386,x86_64,ppc,ppc64
##
## ./configure --launch
## cd build/
## make ub.build.serial
## make ub.combine
##
## EXAMPLE: parallel method, archs: i386,x86_64,ppc,ppc64
##
## ./configure --launch
## cd build/
## make ub.build.parallel
## make ub.combine
##
## EXAMPLE: serial, archs: i386,x86_64 (assuming i386 is native)
##
## ./configure --launch
## cd build/
## make ub.build.parallel UB.archs="i386 x86_64"
## make ub.combine UB.archs="i386 x86_64"
##
UB.archs = i386 x86_64 ppc ppc64
UB.archs.other = $(filter-out $(BUILD.arch),$(UB.archs))
UB.builds = $(wildcard $(foreach n,$(UB.archs.other),$(PROJECT/)build.$n))
UB.BUILD = $(PROJECT/)configure --launch --launch-dir=ub.$(1) --arch=$(1)
## linefeed is important
define UB.BUILD.item
$(call UB.BUILD,$(1))
endef
define UB.BUILD.SERIAL
$(foreach n,$(UB.archs.other),$(call UB.BUILD.item,$n))
endef
define UB.BUILD.PARALLEL
$(call UB.BUILD,$(1)) 2>&1 > ub.$(1).log
endef
define UB.COMBINE
$(RM.exe) -fr ub.combine
$(MKDIR.exe) -p ub.combine
$(CP.exe) -R HandBrake.app ub.combine/.
lipo $(1) $(foreach n,$(UB.archs.other),ub.$n/$(1)) -create -output ub.combine/$(1)
@echo ""
@sync; lipo -info ub.combine/$(1)
@du -sh ub.combine/$(1)
endef
|