1#
2#                     The LLVM Compiler Infrastructure
3#
4# This file is distributed under the University of Illinois Open Source
5# License. See LICENSE.TXT for details.
6CCDIR=/usr/bin
7#CCDIR=/Volumes/Keep/gcc/usr/bin
8
9all: std
10
11clean:
12	rm -fr *.dSYM *.o *-bin testfilerunner
13
14TFR = ~public/bin/testfilerunner
15
16testfilerunner: testfilerunner.h testfilerunner.m
17	gcc -fobjc-gc-only -g -arch x86_64 -arch i386 -std=gnu99 testfilerunner.m -o testfilerunner -framework Foundation
18
19tests:
20	grep CONFIG *.[cmCM] | $(TFR) $(CCDIR) --
21
22open:
23	grep CONFIG *.[cmCM] | $(TFR) $(CCDIR) -open --
24
25fast:
26	grep CONFIG *.[cmCM] | $(TFR) -fast $(CCDIR) --
27
28std:
29	grep CONFIG *.[cmCM] | $(TFR) --
30
31clang:
32	grep CONFIG *.[cmCM] | $(TFR) -clang -fast --
33
34fastd:
35	grep CONFIG *.[cmCM] | $(TFR) -fast --
36
37
38# Hack Alert: arguably most of the following belongs in libclosure's Makefile; sticking it here until I get around to grokking what goes on in that file.
39sudid:
40	@echo Enabling sudo:  # Hack Alert: enable sudo first thing so we don't hang at the password prompt later
41	@sudo echo Thanks
42
43
44RootsDirectory ?= /tmp/
45# Note: the libsystem project (built by the libsystemroot target below) uses the ALTUSRLOCALLIBSYSTEM variable, so we use it here to maintain parity
46ALTUSRLOCALLIBSYSTEM ?= $(RootsDirectory)/alt-usr-local-lib-system/
47altusrlocallibsystem:
48	ditto /usr/local/lib/system $(ALTUSRLOCALLIBSYSTEM)  # FIXME: conditionalize this copy
49
50
51# <rdar://problem/6456031> ER: option to not require extra privileges (-nosudo or somesuch)
52Buildit ?= ~rc/bin/buildit -rootsDirectory $(RootsDirectory) -arch i386 -arch ppc -arch x86_64
53blocksroot: sudid clean altusrlocallibsystem
54	sudo $(Buildit) ..
55	ditto $(RootsDirectory)/libclosure.roots/libclosure~dst/usr/local/lib/system $(ALTUSRLOCALLIBSYSTEM)
56
57
58LibsystemVersion ?= 121
59LibsystemPath ?= ~rc/Software/SnowLeopard/Projects/Libsystem/Libsystem-$(LibsystemVersion)
60LibsystemTmpPath ?= $(RootsDirectory)/Libsystem-$(LibsystemVersion)
61libsystemroot: blocksroot
62	ditto $(LibsystemPath) $(LibsystemTmpPath)  # FIXME: conditionalize this copy
63	sudo ALTUSRLOCALLIBSYSTEM=$(ALTUSRLOCALLIBSYSTEM) $(Buildit) $(LibsystemTmpPath)
64
65
66# Defaults to product of the libsystemroot target but does not automatically rebuild that, make both targets if you want a fresh root
67LibsystemRootPath ?= $(RootsDirectory)/Libsystem-$(LibsystemVersion).roots/Libsystem-$(LibsystemVersion)~dst/usr/lib/
68roottests: 
69	grep CONFIG *.[cmCM] | $(TFR) -dyld $(LibsystemRootPath) --  # FIXME: figure out if I can "call" the std target instead of duplicating it
70
71