summaryrefslogtreecommitdiff
path: root/tizen/src/Makefile
blob: 5d5824f9cae7fb267f82738c26113b77858704fc (plain)
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
EMUL_DIR=../emulator
DIBS_X86_DIR=../x86
DIBS_ARM_DIR=../arm
DIBS_COMMON_DIR=../common

ifndef TIZEN_SDK_DEV_PATH
TIZEN_SDK_DEV_PATH=${HOME}/tizen-sdk-dev
endif

ifneq ($(wildcard ../../config-host.mak),)
include ../../config-host.mak
else
config-host.mak:
	@echo "Please call configure before running make!"
	@exit 1
endif

ifdef CONFIG_WIN32
EXECUTABLE_EXTENSION=.exe
else
EXECUTABLE_EXTENSION=
endif

all: qemu skin_client
qemu: build_info check_hax check_cam
	cd ../../ && $(MAKE)
qemu_clean:
	cd ../../ && $(MAKE) clean

qemu_distclean:
	cd ../../ && $(MAKE) distclean

check_hax:
	@echo "build check hax"	
ifdef CONFIG_WIN32
	$(CC) -o check-hax.exe check_hax.c	
endif
ifdef CONFIG_DARWIN
	$(CC) -mmacosx-version-min=10.4 -o check-hax check_hax.c	
endif

check_cam:
	@echo "build check cam"
ifdef CONFIG_LINUX
	$(CC) -o check-cam check_cam.c -lv4l2 -lv4lconvert
endif
ifdef CONFIG_WIN32
	$(CC) -o check-cam.exe check_cam.c -lole32 -loleaut32 -luuid -lstrmiids
endif
ifdef CONFIG_DARWIN
	$(CC) -o check-cam check_cam.c
endif

skin_client:
	TIZEN_SDK_DEV_PATH=${TIZEN_SDK_DEV_PATH} ant -buildfile skin/client/build.xml make-jar

build_info:
	@echo "Generate a build information file"
	@echo "/* Automatically generated by Makefile - do not modify! */" > build_info.h
	@echo "const char build_version[] = \"`cat VERSION`\";" >> build_info.h
	@echo "const char build_date[] = \"`date +"%F %T %Z"`\";" >> build_info.h
	@echo "const char pkginfo_version[] = \"`sed -n '1p' ./../../package/pkginfo.manifest | sed 's/\"//g'`\";" >> build_info.h
	@echo "const char pkginfo_maintainer[] = \"`sed -n '2p' ./../../package/pkginfo.manifest | sed 's/\"//g'`\";" >> build_info.h
	@echo "const char pkginfo_githead[] = \"`git rev-parse HEAD`\";" >> build_info.h
	@echo "const char latest_gittag[] = \"`git for-each-ref --count=1 --sort=-taggerdate refs/tags/ --format='Latest Git Tag : %(refname:short) (%(subject))' | sed 's/\"//g'`\";" >> build_info.h


clean: qemu_clean
ifndef CONFIG_LINUX
	rm -f check-hax$(EXECUTABLE_EXTENSION) check-cam$(EXECUTABLE_EXTENSION)
else
	rm -f check-cam
endif
distclean: clean qemu_distclean

install: all
	mkdir -p $(EMUL_DIR)/bin
	mkdir -p $(EMUL_DIR)/etc
	mkdir -p $(EMUL_DIR)/data
	mkdir -p $(EMUL_DIR)/images

	@for target in $(TARGET_DIRS); do \
	case "$$target" in \
	i386-softmmu) \
		mkdir -p $(EMUL_DIR)/data/bios ;\
		echo "Copying i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) to $(EMUL_DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION)" ;\
		cp -pP ../../i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION) ;\
		echo "Copying bioses to $(EMUL_DIR)/data/bios" ;\
		cp -pP ../../pc-bios/bios.bin $(EMUL_DIR)/data/bios ;\
		cp -pP ../../pc-bios/linuxboot.bin $(EMUL_DIR)/data/bios ;\
		cp -pP ../../pc-bios/efi-virtio.rom $(EMUL_DIR)/data/bios ;\
		cp -pP ../../pc-bios/acpi-dsdt.aml $(EMUL_DIR)/data/bios ;\
		;; \
	arm-softmmu) \
		echo "Copying arm-softmmu/qemu-system-arm$(EXECUTABLE_EXTENSION) to $(EMUL_DIR)/bin/emulator-arm$(EXECUTABLE_EXTENSION)" ;\
		cp -pP ../../arm-softmmu/qemu-system-arm$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin/emulator-arm$(EXECUTABLE_EXTENSION) ;\
		;; \
	esac; \
	done

	cp -pP ../../qemu-img$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin

# resources and jar for skin
	cp -pP skin/client/emulator-skin.jar $(EMUL_DIR)/bin
	cp -pPR skin/client/skins $(EMUL_DIR)
ifndef CONFIG_USE_SHM
	cp -pP skin/client/resource/images/blank-guide.png $(EMUL_DIR)/images
endif

# check capabilities of OpenGL and Webcam
	cp -pP ../../i386-softmmu/check-gl$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin
	cp -pP check-cam$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin

# Enable HW Virtualization on Linux
ifdef CONFIG_LINUX
	cp -pP ../distrib/initscript/tizen-kvm $(EMUL_DIR)/etc
	cp -pP ../distrib/initscript/45-tizen-kvm.rules $(EMUL_DIR)/etc
endif

# check HW Virtualization on Windows and MAC OS X.
ifndef CONFIG_LINUX
	cp -pP check-hax$(EXECUTABLE_EXTENSION) $(EMUL_DIR)/bin
endif

# give a title name for sdb terminal.
ifdef CONFIG_DARWIN
	cp -pP sdbscript $(EMUL_DIR)/bin
endif

# use shared memory for display framebuffer
ifdef CONFIG_USE_SHM
ifdef CONFIG_LINUX
	cp -pP skin/client/native_src/libshared.so $(EMUL_DIR)/bin
endif
ifdef CONFIG_DARWIN
	cp -pP skin/client/native_src/libshared.dylib $(EMUL_DIR)/bin
endif
endif

# use GTK for CopyToClipboard on Ubuntu 12.04 64bit
ifdef CONFIG_LINUX
	cp -pP skin/client/native_src/clipboard.py $(EMUL_DIR)/bin
endif

# change loading path of dynamic shared libraries on MAC OS X
ifdef CONFIG_DARWIN
	install_name_tool -change /opt/local/lib/libgthread-2.0.*.dylib @loader_path/libgthread-2.0.0.dylib $(EMUL_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/libglib-2.0.*.dylib @loader_path/libglib-2.0.0.dylib $(EMUL_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/libintl.8.dylib @loader_path/libintl.8.dylib $(EMUL_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/gcc47/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib $(EMUL_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/libz.1.dylib @loader_path/libz.1.dylib $(EMUL_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/libcurl.4.dylib @loader_path/libcurl.4.dylib $(EMUL_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/libglib-2.0.*.dylib @loader_path/libglib-2.0.0.dylib $(EMUL_DIR)/bin/check-gl
	install_name_tool -change /opt/local/lib/libintl.8.dylib @loader_path/libintl.8.dylib $(EMUL_DIR)/bin/check-gl
	install_name_tool -change /opt/local/lib/gcc47/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib $(EMUL_DIR)/bin/check-gl

	@for target in $(TARGET_DIRS); do \
	case "$$target" in \
	i386-softmmu) \
		install_name_tool -change /opt/local/lib/libgthread-2.0.*.dylib @loader_path/libgthread-2.0.0.dylib $(EMUL_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libglib-2.0.*.dylib @loader_path/libglib-2.0.0.dylib $(EMUL_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libintl.8.dylib @loader_path/libintl.8.dylib $(EMUL_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/gcc47/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib $(EMUL_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libz.1.dylib @loader_path/libz.1.dylib $(EMUL_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libncurses.5.dylib @loader_path/libncurses.5.dylib $(EMUL_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libcurl.4.dylib @loader_path/libcurl.4.dylib $(EMUL_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libpixman-1.0.dylib @loader_path/libpixman-1.0.dylib $(EMUL_DIR)/bin/emulator-x86 ;\
		;; \
	arm-softmmu) \
		;; \
	esac; \
	done
endif

# for dibs system...
all_dibs: qemu skin_client_dibs
skin_client_dibs:
	ant -buildfile skin/client/build.xml -Dclasspath.dibs=$(ROOTDIR)/tools/emulator/bin make-jar-dibs
install_dibs: all_dibs
	mkdir -p $(DIBS_COMMON_DIR)/bin
	mkdir -p $(DIBS_COMMON_DIR)/etc
	mkdir -p $(DIBS_COMMON_DIR)/images
	mkdir -p $(DIBS_X86_DIR)/bin
	mkdir -p $(DIBS_X86_DIR)/data
	mkdir -p $(DIBS_X86_DIR)/etc
	mkdir -p $(DIBS_ARM_DIR)/bin
	@for target in $(TARGET_DIRS); do \
	case "$$target" in \
	i386-softmmu) \
		mkdir -p $(DIBS_X86_DIR)/data/bios ;\
		echo "Copying i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) to $(DIBS_X86__DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION)" ;\
		cp ../../i386-softmmu/qemu-system-i386$(EXECUTABLE_EXTENSION) $(DIBS_X86_DIR)/bin/emulator-x86$(EXECUTABLE_EXTENSION) ;\
		echo "Copying bioses to $(DIBS_X86_DIR)/data/bios" ;\
		cp -pP ../../pc-bios/bios.bin $(DIBS_X86_DIR)/data/bios ;\
		cp -pP ../../pc-bios/linuxboot.bin $(DIBS_X86_DIR)/data/bios ;\
		cp -pP ../../pc-bios/efi-virtio.rom $(DIBS_X86_DIR)/data/bios ;\
		cp -pP ../../pc-bios/acpi-dsdt.aml $(DIBS_X86_DIR)/data/bios ;\
		;; \
	arm-softmmu) \
		echo "Copying arm-softmmu/qemu-system-arm$(EXECUTABLE_EXTENSION) to $(DIBS_ARM_DIR)/bin/emulator-arm$(EXECUTABLE_EXTENSION)" ;\
		cp -pP ../../arm-softmmu/qemu-system-arm$(EXECUTABLE_EXTENSION) $(DIBS_ARM_DIR)/bin/emulator-arm$(EXECUTABLE_EXTENSION) ;\
		;; \
	esac; \
	done

	cp -pP ../../qemu-img$(EXECUTABLE_EXTENSION) $(DIBS_COMMON_DIR)/bin

# resources and jar for skin
	cp -pP skin/client/emulator-skin.jar $(DIBS_COMMON_DIR)/bin
	#cp -pPR skin/client/skins $(DIBS_COMMON_DIR)
	#rm -rf $(DIBS_COMMON_DIR)/skins/mobile-480x800-3btn/
	#rm -rf $(DIBS_COMMON_DIR)/skins/mobile-720x1280-3btn/
ifndef CONFIG_USE_SHM
	cp -pP skin/client/resource/images/blank-guide.png $(DIBS_COMMON_DIR)/images
endif

# check capabilities of OpenGL and Webcam
	cp -pP ../../i386-softmmu/check-gl$(EXECUTABLE_EXTENSION) $(DIBS_COMMON_DIR)/bin
	cp -pP check-cam$(EXECUTABLE_EXTENSION) $(DIBS_COMMON_DIR)/bin


# Enable HW Virtualization on Linux
ifdef CONFIG_LINUX
	echo "Copying tizen-kvm to $(DIBS_X86_DIR)/etc"
	cp -pP ../distrib/initscript/tizen-kvm $(DIBS_X86_DIR)/etc
	cp -pP ../distrib/initscript/45-tizen-kvm.rules $(DIBS_X86_DIR)/etc
endif

# check HW Virtualization on Windows and MAC OS X.
ifndef CONFIG_LINUX
	cp -pP check-hax$(EXECUTABLE_EXTENSION) $(DIBS_COMMON_DIR)/bin
endif

# give a title name for sdb terminal.
ifdef CONFIG_DARWIN
	cp -pP sdbscript $(DIBS_COMMON_DIR)/bin
endif

# use shared memory for display framebuffer
ifdef CONFIG_USE_SHM
ifdef CONFIG_LINUX
	cp -pP skin/client/native_src/libshared.so $(DIBS_COMMON_DIR)/bin
endif
ifdef CONFIG_DARWIN
	cp -pP skin/client/native_src/libshared.dylib $(DIBS_COMMON_DIR)/bin
endif
endif

# use GTK for CopyToClipboard on Ubuntu 12.04 64bit
ifdef CONFIG_LINUX
	cp -pP skin/client/native_src/clipboard.py $(DIBS_COMMON_DIR)/bin
endif

# change loading path of dynamic shared libraries on MAC OS X
ifdef CONFIG_DARWIN
	install_name_tool -change /opt/local/lib/libgthread-2.0.*.dylib @loader_path/libgthread-2.0.0.dylib $(DIBS_COMMON_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/libglib-2.0.*.dylib @loader_path/libglib-2.0.0.dylib $(DIBS_COMMON_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/libintl.8.dylib @loader_path/libintl.8.dylib $(DIBS_COMMON_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/gcc47/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib $(DIBS_COMMON_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/libz.1.dylib @loader_path/libz.1.dylib $(DIBS_COMMON_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/libcurl.4.dylib @loader_path/libcurl.4.dylib $(DIBS_COMMON_DIR)/bin/qemu-img
	install_name_tool -change /opt/local/lib/libglib-2.0.*.dylib @loader_path/libglib-2.0.0.dylib $(DIBS_COMMON_DIR)/bin/check-gl
	install_name_tool -change /opt/local/lib/libintl.8.dylib @loader_path/libintl.8.dylib $(DIBS_COMMON_DIR)/bin/check-gl
	install_name_tool -change /opt/local/lib/gcc47/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib $(DIBS_COMMON_DIR)/bin/check-gl

	@for target in $(TARGET_DIRS); do \
	case "$$target" in \
	i386-softmmu) \
		install_name_tool -change /opt/local/lib/libgthread-2.0.*.dylib @loader_path/libgthread-2.0.0.dylib $(DIBS_X86_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libglib-2.0.*.dylib @loader_path/libglib-2.0.0.dylib $(DIBS_X86_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libintl.8.dylib @loader_path/libintl.8.dylib $(DIBS_X86_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/gcc47/libgcc_s.1.dylib @loader_path/libgcc_s.1.dylib $(DIBS_X86_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libz.1.dylib @loader_path/libz.1.dylib $(DIBS_X86_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libncurses.5.dylib @loader_path/libncurses.5.dylib $(DIBS_X86_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libcurl.4.dylib @loader_path/libcurl.4.dylib $(DIBS_X86_DIR)/bin/emulator-x86 ;\
		install_name_tool -change /opt/local/lib/libpixman-1.0.dylib @loader_path/libpixman-1.0.dylib $(DIBS_X86_DIR)/bin/emulator-x86 ;\
		;; \
	arm-softmmu) \
		;; \
	esac; \
	done
endif