1ARCHS   ?= x86_64 
2cwd  := $(shell pwd)
3
4#Path1 := "/Developer/Applications/Utilities/PackageMaker.app"
5#Path2 := "/DevTools/Utilities/PackageMaker.app"
6#PPATH := $(shell if [ -d ${Path1} ]; then echo ${Path1}; else if [ -d ${Path2} ]; then echo ${Path2}; fi; fi)
7#PM := "${PPATH}/Contents/MacOS/PackageMaker"
8
9# grab the long version number out of my prefix file
10version  := $(word 3, $(shell grep VersionNumber ../Common/AppleUSBCDCCommon.h))
11
12NAME := AppleUSBCDCDriver-${version}
13PKG  := ../build/${NAME}.pkg
14TMP  := /tmp/cdc.root/
15#DMG  := ../build/${NAME}.dmg
16TARBALL  := "${cwd}/../build/${NAME}-Root.tar.gz"
17
18
19all:	${PKG}
20
21clean:
22	sudo rm -rf ${TMP}
23
24#${PKG}:
25#	${PM} --doc AppleUSBCDCDriver.pmdoc --out "${PKG}"
26
27#${DMG}:	${PKG}
28#	rm -f ${DMG}
29#	/usr/bin/perl buildDMG.pl -buildDir ../build/ -compressionLevel 9 -dmgName ${NAME} -volName ${NAME} ${PKG}
30
31${PKG}:
32	(cd .. ; sudo xcodebuild ARCHS="${ARCHS}" install DSTROOT="${TMP}" )
33	sudo pkgbuild --root=${TMP} --identifier com.apple.iokit.AppleUSBCDCDriver --version ${version} ${PKG}
34	(cd ${TMP} ; sudo tar cvzf ${TARBALL} .)
35	ls -ltr ../build
36