18c1441f8SAlexey Samsonov#
2*2946cd70SChandler Carruth# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3*2946cd70SChandler Carruth# See https://llvm.org/LICENSE.txt for license information.
4*2946cd70SChandler Carruth# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
58c1441f8SAlexey SamsonovCCDIR=/usr/bin
68c1441f8SAlexey Samsonov#CCDIR=/Volumes/Keep/gcc/usr/bin
78c1441f8SAlexey Samsonov
88c1441f8SAlexey Samsonovall: std
98c1441f8SAlexey Samsonov
108c1441f8SAlexey Samsonovclean:
118c1441f8SAlexey Samsonov	rm -fr *.dSYM *.o *-bin testfilerunner
128c1441f8SAlexey Samsonov
138c1441f8SAlexey SamsonovTFR = ~public/bin/testfilerunner
148c1441f8SAlexey Samsonov
158c1441f8SAlexey Samsonovtestfilerunner: testfilerunner.h testfilerunner.m
168c1441f8SAlexey Samsonov	gcc -fobjc-gc-only -g -arch x86_64 -arch i386 -std=gnu99 testfilerunner.m -o testfilerunner -framework Foundation
178c1441f8SAlexey Samsonov
188c1441f8SAlexey Samsonovtests:
198c1441f8SAlexey Samsonov	grep CONFIG *.[cmCM] | $(TFR) $(CCDIR) --
208c1441f8SAlexey Samsonov
218c1441f8SAlexey Samsonovopen:
228c1441f8SAlexey Samsonov	grep CONFIG *.[cmCM] | $(TFR) $(CCDIR) -open --
238c1441f8SAlexey Samsonov
248c1441f8SAlexey Samsonovfast:
258c1441f8SAlexey Samsonov	grep CONFIG *.[cmCM] | $(TFR) -fast $(CCDIR) --
268c1441f8SAlexey Samsonov
278c1441f8SAlexey Samsonovstd:
288c1441f8SAlexey Samsonov	grep CONFIG *.[cmCM] | $(TFR) --
298c1441f8SAlexey Samsonov
308c1441f8SAlexey Samsonovclang:
318c1441f8SAlexey Samsonov	grep CONFIG *.[cmCM] | $(TFR) -clang -fast --
328c1441f8SAlexey Samsonov
338c1441f8SAlexey Samsonovfastd:
348c1441f8SAlexey Samsonov	grep CONFIG *.[cmCM] | $(TFR) -fast --
358c1441f8SAlexey Samsonov
368c1441f8SAlexey Samsonov
378c1441f8SAlexey Samsonov# 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.
388c1441f8SAlexey Samsonovsudid:
398c1441f8SAlexey Samsonov	@echo Enabling sudo:  # Hack Alert: enable sudo first thing so we don't hang at the password prompt later
408c1441f8SAlexey Samsonov	@sudo echo Thanks
418c1441f8SAlexey Samsonov
428c1441f8SAlexey Samsonov
438c1441f8SAlexey SamsonovRootsDirectory ?= /tmp/
448c1441f8SAlexey Samsonov# Note: the libsystem project (built by the libsystemroot target below) uses the ALTUSRLOCALLIBSYSTEM variable, so we use it here to maintain parity
458c1441f8SAlexey SamsonovALTUSRLOCALLIBSYSTEM ?= $(RootsDirectory)/alt-usr-local-lib-system/
468c1441f8SAlexey Samsonovaltusrlocallibsystem:
478c1441f8SAlexey Samsonov	ditto /usr/local/lib/system $(ALTUSRLOCALLIBSYSTEM)  # FIXME: conditionalize this copy
488c1441f8SAlexey Samsonov
498c1441f8SAlexey Samsonov
508c1441f8SAlexey Samsonov# <rdar://problem/6456031> ER: option to not require extra privileges (-nosudo or somesuch)
518c1441f8SAlexey SamsonovBuildit ?= ~rc/bin/buildit -rootsDirectory $(RootsDirectory) -arch i386 -arch ppc -arch x86_64
528c1441f8SAlexey Samsonovblocksroot: sudid clean altusrlocallibsystem
538c1441f8SAlexey Samsonov	sudo $(Buildit) ..
548c1441f8SAlexey Samsonov	ditto $(RootsDirectory)/libclosure.roots/libclosure~dst/usr/local/lib/system $(ALTUSRLOCALLIBSYSTEM)
558c1441f8SAlexey Samsonov
568c1441f8SAlexey Samsonov
578c1441f8SAlexey SamsonovLibsystemVersion ?= 121
588c1441f8SAlexey SamsonovLibsystemPath ?= ~rc/Software/SnowLeopard/Projects/Libsystem/Libsystem-$(LibsystemVersion)
598c1441f8SAlexey SamsonovLibsystemTmpPath ?= $(RootsDirectory)/Libsystem-$(LibsystemVersion)
608c1441f8SAlexey Samsonovlibsystemroot: blocksroot
618c1441f8SAlexey Samsonov	ditto $(LibsystemPath) $(LibsystemTmpPath)  # FIXME: conditionalize this copy
628c1441f8SAlexey Samsonov	sudo ALTUSRLOCALLIBSYSTEM=$(ALTUSRLOCALLIBSYSTEM) $(Buildit) $(LibsystemTmpPath)
638c1441f8SAlexey Samsonov
648c1441f8SAlexey Samsonov
658c1441f8SAlexey Samsonov# Defaults to product of the libsystemroot target but does not automatically rebuild that, make both targets if you want a fresh root
668c1441f8SAlexey SamsonovLibsystemRootPath ?= $(RootsDirectory)/Libsystem-$(LibsystemVersion).roots/Libsystem-$(LibsystemVersion)~dst/usr/lib/
678c1441f8SAlexey Samsonovroottests:
688c1441f8SAlexey Samsonov	grep CONFIG *.[cmCM] | $(TFR) -dyld $(LibsystemRootPath) --  # FIXME: figure out if I can "call" the std target instead of duplicating it
698c1441f8SAlexey Samsonov
70