| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 | # Binaries that should generate the same output every timeEXPECT_NAMES=\	alloca \	args \	arpainet \	assert \	constructor \	ctype \	destructor \	dirent/scandir \	errno \	error \	fcntl/create \	fcntl/fcntl \	fnmatch \	futimens \	libgen \	locale \	math \	netdb/getaddrinfo \	ptrace \	regex \	select \	setjmp \	sigaction \	signal \	stdio/all \	stdio/buffer \	stdio/fgets \	stdio/fputs \	stdio/fread \	stdio/freopen \	stdio/fseek \	stdio/fwrite \	stdio/getc_unget \	stdio/mutex \	stdio/popen \	stdio/printf \	stdio/rename \	stdio/scanf \	stdio/setvbuf \	stdio/sprintf \	stdio/printf_space_pad \	stdio/ungetc_ftell \	stdio/ungetc_multiple \	stdio/fscanf_offby1 \	stdio/fscanf \	stdio/printf_neg_pad \	stdlib/a64l \	stdlib/alloc \	stdlib/atof \	stdlib/atoi \	stdlib/div \	stdlib/env \	stdlib/mkostemps \	stdlib/rand \	stdlib/rand48 \	stdlib/random \	stdlib/strtod \	stdlib/strtol \	stdlib/strtoul \	stdlib/system \	string/mem \	string/strcat \	string/strchr \	string/strcpy \	string/strcspn \	string/strlen \	string/strncmp \	string/strpbrk \	string/strrchr \	string/strspn \	string/strstr \	string/strtok \	string/strtok_r \	string/strsignal \	strings \	sys_mman \	time/asctime \	time/constants \	time/gmtime \	time/localtime \	time/macros \	time/mktime \	time/strftime \	time/time \	tls \	unistd/access \	unistd/brk \	unistd/dup \	unistd/exec \	unistd/fchdir \	unistd/fork \	unistd/fsync \	unistd/ftruncate \	unistd/getopt \	unistd/getopt_long \	unistd/pipe \	unistd/rmdir \	unistd/sleep \	unistd/swab \	unistd/write \	waitpid \	wchar/fwide \	wchar/mbrtowc \	wchar/mbsrtowcs \	wchar/printf-on-wchars \	wchar/putwchar \	wchar/wcrtomb \	wchar/wcscspn \	wchar/wcsrchr \	wchar/wcsstr \	wchar/wcstod \	wchar/wcstok \	wchar/wcstol \	wchar/wcscasecmp \	wchar/wcsncasecmp \	wctype/towlower \	wctype/towupper	# TODO: Fix these	# mkfifo	# netdb/netdb \DYNAMIC_ONLY_NAMES=\	dlfcn# Binaries that may generate varied outputNAMES=\	$(EXPECT_NAMES) \	dirent/main \	pwd \	stdio/tempnam \	stdio/tmpnam \	stdlib/bsearch \	stdlib/mktemp \	stdlib/realpath \	sys_epoll/epoll \	sys_utsname/uname \	time/gettimeofday \	unistd/chdir \	unistd/getcwd \	unistd/gethostname \	unistd/getid \	unistd/getpagesize \	unistd/isatty \	unistd/link \	unistd/pathconf \	unistd/setid \	unistd/stat \	unistd/sysconf#	resource/getrusage#	time/timesBINS=$(patsubst %,bins_static/%,$(NAMES))BINS+=$(patsubst %,bins_dynamic/%,$(NAMES))BINS+=$(patsubst %,bins_dynamic/%,$(DYNAMIC_ONLY_NAMES))EXPECT_BINS=$(patsubst %,bins_static/%,$(EXPECT_NAMES))EXPECT_BINS+=$(patsubst %,bins_dynamic/%,$(EXPECT_NAMES))EXPECT_BINS+=$(patsubst %,bins_dynamic/%,$(DYNAMIC_ONLY_NAMES))TEST_RUNNER?=sh --.PHONY: all clean run expected verifyall: $(BINS)clean:	rm -rf bins_* gen *.outrun: | $(BINS)	for bin in $(BINS); \	do \		echo "# $${bin} #"; \		"$${bin}" test args || exit $$?; \	doneexpected: | $(EXPECT_BINS)	rm -rf expected	mkdir -p expected	for bin in $(EXPECT_BINS); \	do \		echo "# $${bin} #"; \		mkdir -p expected/`dirname $${bin}`; \		"$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr" || exit $$?; \	doneverify: | $(EXPECT_BINS)	$(TEST_RUNNER) ./verify.sh $(EXPECT_BINS)FLAGS=\	-std=c11 \	-fno-builtin \	-fno-stack-protector \	-Wall \	-pedantic \	-g \	-I .STATIC_FLAGS=\	-staticDYNAMIC_FLAGS=\	-Wl,--enable-new-dtags \	-Wl,-export-dynamic../sysroot:	$(MAKE) -C .. sysrootNATIVE_RELIBC?=0ifeq ($(NATIVE_RELIBC),0)FLAGS+=\	-nostdinc \	-nostdlib \	-isystem ../sysroot/include \	../sysroot/lib/crt0.o \	../sysroot/lib/crti.o \	../sysroot/lib/crtn.oSYSROOT_LIB=$(shell realpath ../sysroot/lib/)STATIC_FLAGS+=\	$(SYSROOT_LIB)/libc.aDYNAMIC_FLAGS+=\	-Wl,-dynamic-linker=$(SYSROOT_LIB)/ld64.so.1 \	-Wl,-rpath=$(SYSROOT_LIB):\$$ORIGIN \	-L $(SYSROOT_LIB) \	-lcDEPS=../sysrootelseDYNAMIC_FLAGS+=\	-Wl,-rpath=\$$ORIGINendifbins_static/%: %.c $(DEPS)	mkdir -p "$$(dirname "$@")"	$(CC) "$<" -o "$@" $(FLAGS) $(STATIC_FLAGS)bins_dynamic/%.so: %.c $(DEPS)	mkdir -p "$$(dirname "$@")"	$(CC) "$<" -o "$@" -shared -fpic $(FLAGS) $(DYNAMIC_FLAGS)bins_dynamic/dlfcn: dlfcn.c bins_dynamic/sharedlib.so $(DEPS)	mkdir -p "$$(dirname "$@")"	$(CC) "$<" -o "$@" $(FLAGS) $(DYNAMIC_FLAGS)bins_dynamic/%: %.c $(DEPS)	mkdir -p "$$(dirname "$@")"	$(CC) "$<" -o "$@" $(FLAGS) $(DYNAMIC_FLAGS)
 |