cgpt: supprt MACOS builds

Change-Id: I910041443b8a0ca143de47df91c6268ee2d12132
diff --git a/Makefile b/Makefile
index ca84960..b305025 100644
--- a/Makefile
+++ b/Makefile
@@ -564,25 +564,30 @@
 	cgpt/cgpt_boot.c \
 	cgpt/cgpt_common.c \
 	cgpt/cgpt_create.c \
-	cgpt/cgpt_find.c \
 	cgpt/cgpt_legacy.c \
-	cgpt/cgpt_nor.c \
 	cgpt/cgpt_prioritize.c \
 	cgpt/cgpt_repair.c \
 	cgpt/cgpt_show.c \
 	cgpt/cmd_add.c \
 	cgpt/cmd_boot.c \
 	cgpt/cmd_create.c \
-	cgpt/cmd_find.c \
 	cgpt/cmd_legacy.c \
 	cgpt/cmd_prioritize.c \
 	cgpt/cmd_repair.c \
 	cgpt/cmd_show.c
 
+ifndef HAVE_MACOS
+	CGPT_SRCS += \
+							cgpt/cgpt_nor.c \
+							cgpt/cmd_find.c \
+							cgpt/cgpt_find.c
+endif
+
 CGPT_OBJS = ${CGPT_SRCS:%.c=${BUILD}/%.o}
 
 ALL_OBJS += ${CGPT_OBJS}
 
+ifndef HAVE_MACOS
 CGPT_WRAPPER = ${BUILD}/cgpt/cgpt_wrapper
 
 CGPT_WRAPPER_SRCS = \
@@ -592,6 +597,7 @@
 CGPT_WRAPPER_OBJS = ${CGPT_WRAPPER_SRCS:%.c=${BUILD}/%.o}
 
 ALL_OBJS += ${CGPT_WRAPPER_OBJS}
+endif
 
 # Utility defaults
 UTIL_DEFAULTS = ${BUILD}/default/vboot_reference
@@ -1081,7 +1087,11 @@
 .PHONY: cgpt
 cgpt: ${CGPT} ${CGPT_WRAPPER}
 
+ifdef HAVE_MACOS
+${CGPT}: LDLIBS += -lSystem
+else
 ${CGPT}: LDLIBS += -luuid
+endif
 
 ${CGPT}: ${CGPT_OBJS} ${UTILLIB}
 	@${PRINTF} "    LDcgpt        $(subst ${BUILD}/,,$@)\n"
diff --git a/cgpt/cgpt.c b/cgpt/cgpt.c
index 3809200..d0026f0 100644
--- a/cgpt/cgpt.c
+++ b/cgpt/cgpt.c
@@ -33,7 +33,9 @@
   {"show", cmd_show, "Show partition table and entries"},
   {"repair", cmd_repair, "Repair damaged GPT headers and tables"},
   {"boot", cmd_boot, "Edit the PMBR sector for legacy BIOSes"},
+#ifndef HAVE_MACOS
   {"find", cmd_find, "Locate a partition by its GUID"},
+#endif
   {"prioritize", cmd_prioritize,
    "Reorder the priority of all kernel partitions"},
   {"legacy", cmd_legacy, "Switch between GPT and Legacy GPT"},
diff --git a/cgpt/cgpt.h b/cgpt/cgpt.h
index 1216a72..89ef6b4 100644
--- a/cgpt/cgpt.h
+++ b/cgpt/cgpt.h
@@ -197,7 +197,9 @@
 int cmd_create(int argc, char *argv[]);
 int cmd_add(int argc, char *argv[]);
 int cmd_boot(int argc, char *argv[]);
+#ifndef HAVE_MACOS
 int cmd_find(int argc, char *argv[]);
+#endif
 int cmd_prioritize(int argc, char *argv[]);
 int cmd_legacy(int argc, char *argv[]);