-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
187 lines (140 loc) · 6.37 KB
/
Makefile
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# -*- makefile -*- Crossplex Library Install Makefile
#
# This program Copyright (C) 2000-2009 David Wuertele
# This program is distributed under the GNU General Public License v2 - see the
# accompanying COPYING file for more details.
ifneq ($(MAKE_VERSION),3.81)
$(warning CROSSPLEX REQUIRES MAKE VERSION 3.81 TO RUN!)
NEEDFORCE := 1
else
NEEDFORCE := 0
endif
FORCE ?= 0
VERSION := crossplex-0.12.0
DESTDIR ?= /usr/local
LIBDIR ?= $(DESTDIR)/lib
BINDIR ?= $(DESTDIR)/bin
ETCDIR ?= $(DESTDIR)/etc
LIBFILES_TOFIX := $(patsubst %.in,%,$(filter %.in,$(shell find lib -type f)))
LIBFILES_NOFIX := $(filter-out $(patsubst %,%.in,$(LIBFILES_TOFIX)) $(LIBFILES_TOFIX),$(shell find lib -type f))
$(warning LIBFILES_TOFIX = $(LIBFILES_TOFIX))
$(warning LIBFILES_NOFIX = $(LIBFILES_NOFIX))
ETCFILES := MOTOROLA_README COPYING Makefile
LIBFILES := $(patsubst lib/%,%,$(LIBFILES_NOFIX) $(LIBFILES_TOFIX))
BINFILES := crossplex-project freshmeat-downloader
INSTALLED_LIBFILES := $(patsubst %,$(LIBDIR)/$(VERSION)/%,$(LIBFILES))
INSTALLED_BINFILES := $(patsubst %,$(BINDIR)/%,$(BINFILES))
help:
@echo
@echo This makefile simply copies the contents of the bin and lib directories to the destination of your choice.
@echo
@echo "Default usage (installs in $(LIBDIR)/$(VERSION) and $(BINDIR)):"
@echo
@echo " " make install
@echo
@echo "Specify target prefix:"
@echo
@echo " " make install DESTDIR=/some/path
@echo
@echo "Specify individual lib and bin directories:"
@echo
@echo " " make install LIBDIR=/some/path/to/lib BINDIR=/some/path/to/bin
@echo
ifeq ($(NEEDFORCE),1)
ifeq ($(FORCE),1)
INSTALL_OK := 1
$(warning Forcing crossplex installation with make version $(MAKE_VERSION))
else
$(warning To install crossplex with a different make version, type "$(MAKE) FORCE=1 $(MAKECMDGOALS)")
endif
else
INSTALL_OK := 1
endif
ifeq ($(INSTALL_OK),1)
install: $(INSTALLED_LIBFILES) $(INSTALLED_BINFILES)
$(INSTALLED_LIBFILES): $(LIBDIR)/$(VERSION)/%: lib/%
mkdir -p $(@D)
cp -a $< $@
$(INSTALLED_BINFILES): $(BINDIR)/%: bin/%
mkdir -p $(@D)
cp -a $< $@
bin/%: bin/%.in
perl -pe 's,\@\@\@LIBDIR\@\@\@,"$(LIBDIR)/$(VERSION)",' < $< > [email protected]
chmod +x [email protected]
mv [email protected] $@
$(LIBFILES_TOFIX): lib/templates/%: lib/templates/%.in
perl -pe 's,\@\@\@LIBDIR\@\@\@,"$(LIBDIR)/$(VERSION)",' < $< > [email protected]
chmod +x [email protected]
mv [email protected] $@
endif
dist: ../$(VERSION).tbz
../$(VERSION).tbz: FORCE
git archive -v --format=tar --prefix=$(VERSION)/ HEAD | bzip2 - > $@
FORCE:
checkgit:
rm -rf ../$(VERSION)
mkdir -p ../$(VERSION)
cd ../$(VERSION); git init; git remote add github [email protected]:wuertele/crossplex.git; git pull github master
# cd ../$(VERSION); git init; git remote add github https://github.com/wuertele/crossplex.git; git pull github master
TEST_PATH := $(shell pwd)/test
BUILD_GUEST_IP=10.77.181.25
VMGUEST_NAME=Ubuntu-JeOS-Dev-a4db519
VMGUEST_TARBALL=/nightly/dave/vmware/$(VMGUEST_NAME).tbz
$(VMGUEST_NAME)-$(VERSION)/Ubuntu-JeOS-Dev.vmx $(VMGUEST_NAME)-$(VERSION).tbz: ../$(VERSION).tbz $(VMGUEST_TARBALL)
rm -rf $(VMGUEST_NAME)-$(VERSION) $(VMGUEST_NAME)
tar xvjf "$(VMGUEST_TARBALL)"
mv $(VMGUEST_NAME) $(VMGUEST_NAME)-$(VERSION)
env -i HOME=$(HOME) /usr/bin/vmrun start $(VMGUEST_NAME)-$(VERSION)/Ubuntu-JeOS-Dev.vmx nogui
sleep 60
/usr/bin/scp -i id_cpbuild ../$(VERSION).tbz crossplex@$(BUILD_GUEST_IP):
/usr/bin/ssh $(BUILD_GUEST_IP) -l crossplex -i id_cpbuild "tar xvjf $(VERSION).tbz && find $(VERSION) -exec touch {} \;"
/usr/bin/ssh $(BUILD_GUEST_IP) -l root -i id_cpbuild "cd /home/crossplex/$(VERSION) && make install $(VM_MAKE_ARGS) && shutdown -h now"
sleep 20
tar cvjf $(VMGUEST_NAME)-$(VERSION).tbz $(VMGUEST_NAME)-$(VERSION)
# $1 = one of (davix, udlinux, sbvmdk)
define Test_VMBuild
test-vm-scratchbuild-$1: $(VMGUEST_NAME)-$(VERSION)/Ubuntu-JeOS-Dev.vmx
env -i HOME=$(HOME) /usr/bin/vmrun start $(VMGUEST_NAME)-$(VERSION)/Ubuntu-JeOS-Dev.vmx nogui
sleep 60
/usr/bin/ssh $(BUILD_GUEST_IP) -l crossplex -i id_cpbuild "cd /home/crossplex/$(VERSION)/examples && perl -pe 's/#HTTP_PROXY/HTTP_PROXY/; s/#FTP_PROXY/FTP_PROXY/; s/myproxy.com/wwwgate0.mot.com/' fetch-sources.mk > fetch-sources.mk.new && mv fetch-sources.mk.new fetch-sources.mk && time make $(VM_MAKEARGS) $1 > make.out 2>&1"
/usr/bin/ssh $(BUILD_GUEST_IP) -l root -i id_cpbuild 'shutdown -h now'
test-vm-scratchbuild: test-vm-scratchbuild-$1
test-vm: test-vm-scratchbuild
test-vm-rebuild-$1: $(VMGUEST_NAME)-$(VERSION)/Ubuntu-JeOS-Dev.vmx
env -i HOME=$(HOME) /usr/bin/vmrun start $(VMGUEST_NAME)-$(VERSION)/Ubuntu-JeOS-Dev.vmx nogui
sleep 60
/usr/bin/ssh $(BUILD_GUEST_IP) -l crossplex -i id_cpbuild "cd /home/crossplex/$(VERSION)/examples && perl -pe 's/#HTTP_PROXY/HTTP_PROXY/; s/#FTP_PROXY/FTP_PROXY/; s/myproxy.com/wwwgate0.mot.com/' fetch-sources.mk > fetch-sources.mk.new && mv fetch-sources.mk.new fetch-sources.mk && time make $(VM_MAKEARGS) $1 > make.out 2>&1"
/usr/bin/ssh $(BUILD_GUEST_IP) -l root -i id_cpbuild 'shutdown -h now'
test-vm-rebuild: test-vm-rebuild-$1
test-vm: test-vm-rebuild
test: test-vm
endef
# $1 = one of (davix, udlinux, sbvmdk)
define Test_HostBuild
test-host-scratchbuild-$1:
rm -rf $(TEST_PATH)
$(MAKE) install DESTDIR=$(TEST_PATH)
$(MAKE) -C examples $1 CROSSPLEX_BUILD_INSTALL=$(TEST_PATH) BUILD_TOP=$(TEST_PATH)/build THIRD_PARTY=$(TEST_PATH)/thirdparty
test-host-scratchbuild: test-host-scratchbuild-$1
test-host: test-host-scratchbuild
test-host-rebuild-$1:
$(MAKE) install DESTDIR=$(TEST_PATH)
$(MAKE) -C examples $1 CROSSPLEX_BUILD_INSTALL=$(TEST_PATH) BUILD_TOP=$(TEST_PATH)/build THIRD_PARTY=$(TEST_PATH)/thirdparty
test-host-rebuild: test-host-rebuild-$1
test-host: test-host-rebuild
test: test-host
endef
# $1 = one of (VM, Host)
# $2 = one of (davix, udlinux, sbvmdk)
define Test_Build
$(call Test_$1Build,$2)
endef
# Generate rules for all hosts and all targets
$(eval $(foreach target,sbvmdk davix udlinux,$(foreach where,VM Host,$(call Test_Build,$(where),$(target)))))
$(TEST_PATH)/build/selfrep/playerkit/selfrep.vmdk: lib/kit.mk
$(TEST_PATH)/build/selfrep/playerkit/selfrep.vmdk: test-host-rebuild-sbvmdk
$(TEST_PATH)/build/selfrep/playerkit/handmade.vmx: $(TEST_PATH)/build/selfrep/playerkit/selfrep.vmdk
test-vmplayer: $(TEST_PATH)/build/selfrep/playerkit/selfrep.vmdk
test-vmplayer: $(TEST_PATH)/build/selfrep/playerkit/handmade.vmx
# test the result
vmplayer $(TEST_PATH)/build/selfrep/playerkit/handmade.vmx