1##
2# Mac OS X file system hierarchy
3# Copyright 1999-2007 Apple Inc.
4##
5
6export Project = files
7
8Destination = $(DSTROOT)
9
10# Common Makefile
11include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make
12
13##
14# Read the hierarchy file and create the directories.
15# If the corresponding directory exists in the SRCROOT
16# and contains a Makefile, execute that makefile.
17##
18ifdef RC_TARGET_CONFIG
19Product=$(RC_TARGET_CONFIG)
20else
21Product=MacOSX
22endif
23SRC_HIERARCHY=hierarchy hierarchy.$(Product)
24
25install::
26	@echo "Installing for $(Product)"
27	$(_v) install -d -m 1775 -o root -g admin "$(Destination)"
28	$(_v) set -o pipefail && cat $(SRC_HIERARCHY) | \
29	awk -F '\t'  ' \
30	{	print sprintf("install -d -m %s -o %s -g %s \"$(Destination)/%s\";", $$1, $$2, $$3, $$4); \
31		print sprintf("[ ! -f \"%s/Makefile\" ] || make -C \"%s\" Destination=\"$(Destination)/%s\" $@ ;", $$4, $$4, $$4); \
32	}' | sh -x -e
33
34install::
35	$(_v) $(LN) -fs private/etc "$(Destination)/etc"
36	$(_v) $(CHOWN) -h root:wheel "$(Destination)/etc"
37ifeq "$(Product)" "iPhone"
38	$(_v) $(LN) -fs private/var/tmp "$(Destination)/tmp"
39	$(_v) $(LN) -fs ../private/var/logs "$(Destination)/Library/Logs"
40	$(_v) $(LN) -fs "../../private/var/Managed Preferences/mobile" "$(Destination)/Library/Managed Preferences/mobile"
41	$(_v) $(LN) -fs ../private/var/preferences "$(Destination)/Library/Preferences"
42	$(_v) $(LN) -fs ../private/var/Keychains "$(Destination)/Library/Keychains"
43	$(_v) $(LN) -fs ../private/var/MobileDevice "$(Destination)/Library/MobileDevice"
44else
45	$(_v) $(INSTALL_FILE) -m 0644 -o root -g admin -c /dev/null "$(Destination)/.com.apple.timemachine.donotpresent"
46	#$(_v) $(INSTALL_FILE) -m 0644 -o root -g admin -c /dev/null "$(Destination)/.metadata_never_index"
47	$(_v) $(LN) -fs private/tmp "$(Destination)/tmp"
48	$(_v) $(INSTALL) -m 0664 -o root -g admin -c /dev/null "$(Destination)/.DS_Store"
49	$(_v) $(INSTALL) -m 0664 -o root -g admin -c /dev/null "$(Destination)/Applications/.DS_Store"
50	$(_v) $(INSTALL) -m 0664 -o root -g admin -c /dev/null "$(Destination)/Applications/Utilities/.DS_Store"
51	# rdar://problem/9596025
52	$(_v) $(LN) -fs ../../Applications/Motion.app/Contents/Frameworks/AEProfiling.framework "$(Destination)/Library/Frameworks"
53	$(_v) $(LN) -fs ../../Applications/Motion.app/Contents/Frameworks/AERegistration.framework "$(Destination)/Library/Frameworks"
54	$(_v) $(LN) -fs ../../Applications/Motion.app/Contents/Frameworks/AudioMixEngine.framework "$(Destination)/Library/Frameworks"
55endif
56	$(_v) $(CHOWN) -h root:wheel "$(Destination)/tmp"
57	$(_v) $(CHMOD) -h 0755 "$(Destination)/tmp"
58	$(_v) $(LN) -fs private/var "$(Destination)/var"
59	$(_v) $(CHOWN) -h root:wheel "$(Destination)/var"
60	$(TOUCH) "$(Destination)/.file"
61	$(_v) $(CHOWN) root:nogroup "$(Destination)/.file"
62	$(_v) $(CHMOD) 0 "$(Destination)/.file"
63
64	# $(SYMROOT)/bsd.sb is created by usr/share/sandbox/Makefile
65	# rdar://problem/8207011
66	$(_v) $(INSTALL_DIRECTORY) "$(Destination)/usr/local/share/sandbox/profiles/embedded/imports"
67	$(_v) $(INSTALL_FILE) $(SYMROOT)/bsd.sb "$(Destination)/usr/local/share/sandbox/profiles/embedded/imports/bsd.sb"
68ifeq "$(Product)" "MacOSX"
69	# rdar://problem/11108634
70	$(_v) $(INSTALL_FILE) $(SYMROOT)/bsd.sb "$(Destination)/System/Library/Sandbox/Profiles/bsd.sb"
71endif
72