Print this page
3748 zfs headers should be C++ compatible
Submitted by:   Justin Gibbs <justing@spectralogic.com>
Submitted by:   Will Andrews <willa@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>

@@ -35,10 +35,12 @@
 
 STAT_COMMON_OBJS = timestamp.o
 STAT_COMMON_SRCS = $(STAT_COMMON_OBJS:%.o=$(STATCOMMONDIR)/%.c)
 SRCS += $(STAT_COMMON_SRCS)
 
+OUTPUTS=$(OBJS) $(STAT_COMMON_OBJS) zpool_hdrck.cpp zpool_hdrck.o
+
 LDLIBS += -lzfs -lnvpair -ldevid -lefi -ldiskmgt -luutil -lumem
 
 INCS += -I../../common/zfs -I$(STATCOMMONDIR)
 
 CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS)

@@ -56,14 +58,20 @@
 
 .KEEP_STATE:
 
 all: $(PROG)
 
-$(PROG): $(OBJS) $(STAT_COMMON_OBJS)
+$(PROG): $(OUTPUTS)
         $(LINK.c) -o $@ $(OBJS) $(STAT_COMMON_OBJS) $(LDLIBS)
         $(POST_PROCESS)
 
+zpool_hdrck.o: zpool_hdrck.cpp
+        $(COMPILE.cc) -o $@ $^
+
+zpool_hdrck.cpp:
+        find . -name '*.[ch]' | xargs grep -h '^#include <' > $@
+
 %.o:    $(STATCOMMONDIR)/%.c
         $(COMPILE.c) $<
         $(POST_PROCESS_O)
 
 install: all $(ROOTSBINPROG) $(ROOTUSRSBINLINKS)

@@ -71,11 +79,11 @@
 $(POFILE): $(POFILES)
         $(RM) $@
         $(CAT) $(POFILES) > $@
 
 clean:
-        $(RM) $(OBJS) $(STAT_COMMON_OBJS)
+        $(RM) $(PROG) $(OUTPUTS)
 
 lint:   lint_SRCS
 
 # Links from /usr/sbin to /sbin
 $(ROOTUSRSBINLINKS):