]> git.saurik.com Git - apple/xnu.git/blobdiff - tools/tests/kqueue_tests/Makefile
xnu-2422.1.72.tar.gz
[apple/xnu.git] / tools / tests / kqueue_tests / Makefile
index b51ccd631861e5fde2ba6695c2f086e859d96c51..7bd1baacddb1f10c1669ca16658ad9652b590e62 100755 (executable)
@@ -1,7 +1,36 @@
-all: file timer
+SDKROOT ?= /
+ifeq "$(RC_TARGET_CONFIG)" "iPhone"
+Embedded?=YES
+else
+Embedded?=$(shell echo $(SDKROOT) | grep -iq iphoneos && echo YES || echo NO)
+endif
 
-file:
-       gcc -o file_tests kqueue_file_tests.c -arch i386
+CC:=xcrun -sdk "$(SDKROOT)" cc
 
-timer:
-       gcc -o timer_tests kqueue_timer_tests.c -arch i386 -arch x86_64
+ifdef RC_ARCHS
+    ARCHS:=$(RC_ARCHS)
+  else
+    ifeq "$(Embedded)" "YES"
+      ARCHS:=armv7 armv7s
+    else
+      ARCHS:=x86_64 i386
+  endif
+endif
+
+CFLAGS :=-g $(patsubst %, -arch %,$(ARCHS))
+
+DSTROOT?=$(shell /bin/pwd)
+SYMROOT?=$(shell /bin/pwd)
+
+all: $(addprefix $(DSTROOT)/, file timer)
+
+$(DSTROOT)/file:
+       $(CC) $(CFLAGS) -o $(SYMROOT)/file_tests kqueue_file_tests.c
+       if [ ! -e $(DSTROOT)/file_tests ]; then ditto $(SYMROOT)/file_tests $(DSTROOT)/file_tests; fi
+
+$(DSTROOT)/timer:
+       $(CC) $(CFLAGS) -o $(SYMROOT)/timer_tests kqueue_timer_tests.c
+       if [ ! -e $(DSTROOT)/timer_tests ]; then ditto $(SYMROOT)/timer_tests $(DSTROOT)/timer_tests; fi
+
+clean:
+       rm -rf $(DSTROOT)/file_tests $(DSTROOT)/timer_tests $(SYMROOT)/*.dSYM $(SYMROOT)/file_tests $(SYMROOT)/timer_tests