-# Copyright (C) 2001 Cluster File Systems, Inc.
-#
-# This code is issued under the GNU General Public License.
-# See the file COPYING in this distribution
+if MODULES
+if LINUX
+if !CRAY_PORTALS
-modulenet_DATA = ksocknal$(KMODEXT)
+ modulenet_DATA := ksocknal$(KMODEXT)
-MOSTLYCLEANFILES = *.o *.ko *.mod.c
-DIST_SOURCES = $(ksocknal-objs:%.o=%.c) socknal.h
+endif # !CRAY_PORTALS
+endif # LINUX
+endif # MODULES
+
+DIST_SOURCES := $(ksocknal-objs:%.o=%.c) socknal_lib-linux.h socknal.h
+
+if DARWIN
+
+ macos_PROGRAMS := ksocknal
+
+ nodist_ksocknal_SOURCES := socknal.c socknal_cb.c socknal_lib-darwin.c
+ DIST_SOURCES += socknal_lib-darwin.c socknal_lib-darwin.h
+
+ ksocknal_CFLAGS := $(EXTRA_KCFLAGS)
+ ksocknal_LDFLAGS := $(EXTRA_KLDFLAGS)
+ ksocknal_LDADD := $(EXTRA_KLIBS)
+
+ plist_DATA := Info.plist
+ install_data_hook := fix-kext-ownership
+
+endif # DARWIN
+
+EXTRA_DIST := $(plist_DATA)
+install-data-hook: $(install_data_hook)
+
+MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ socknal_lib.c