# Administration utilities Makefile
-DEFS=
+
SUBDIRS = Lustre
-CFLAGS:=-g -O2 -I$(top_srcdir)/utils -I$(top_srcdir)/portals/include -I$(srcdir)/../include -Wall -L../portals/utils
-KFLAGS:=
-CPPFLAGS = $(HAVE_LIBREADLINE)
-lctl_LDADD := $(LIBREADLINE) -lptlctl
-lload_LDADD := -lptlctl
-bin_PROGRAMS = lfind lstripe
-sbin_PROGRAMS = lctl obdio obdbarrier lload wirecheck
-sbin_SCRIPTS = lconf lmc llanalyze llstat.pl llobdstat.pl lactive load_ldap.sh
+AM_CFLAGS=$(LLCFLAGS)
+AM_CPPFLAGS=$(LLCPPFLAGS)
+AM_LDFLAGS := -L$(top_builddir)/portals/utils
+
+sbin_scripts = lconf lmc llanalyze llstat.pl llobdstat.pl lactive \
+ load_ldap.sh lrun lwizard
+bin_scripts = lfind lstripe
+
+
+if UTILS
+rootsbin_SCRIPTS = mount.lustre
+sbin_PROGRAMS = lctl obdio obdbarrier lload wirecheck wiretest llmount lsd_upcall
+bin_PROGRAMS = lfs
+lib_LIBRARIES = liblustreapi.a
+sbin_SCRIPTS = $(sbin_scripts)
+bin_SCRIPTS = $(bin_scripts)
+endif # UTILS
+
+lctl_LDADD := $(LIBREADLINE) -lptlctl -lpthread
+lfs_LDADD := $(LIBREADLINE) parser.o liblustreapi.a -lptlctl obd.o
+lload_LDADD := $(LIBREADLINE) -lptlctl
+liblustreapi_a_SOURCES = liblustreapi.c
wirecheck_SOURCES = wirecheck.c
-lctl_SOURCES = parser.c obd.c lctl.c parser.h obdctl.h
+wiretest_SOURCES = wiretest.c
+lctl_SOURCES = parser.c obd.c lustre_cfg.c lctl.c parser.h obdctl.h
lload_SOURCES = lload.c
obdio_SOURCES = obdio.c obdiolib.c obdiolib.h
obdbarrier_SOURCES = obdbarrier.c obdiolib.c obdiolib.h
-lfind_SOURCES = lfind.c
-lstripe_SOURCES = lstripe.c
-lfind_CPPFLAGS = -D_XOPEN_SOURCE=500
-EXTRA_DIST = $(sbin_SCRIPTS)
+lfs_SOURCES = lfs.c
+llmount_SOURCES = llmount.c
+llmount_LDADD = $(LIBREADLINE) -lptlctl
+lsd_upcall_SOURCES = lsd_upcall.c
+
+EXTRA_DIST = $(bin_scripts) $(sbin_scripts)
+
+# NOTE: this should only be run on i386.
+newwiretest: wirehdr.c wirecheck
+ cp wirehdr.c wiretest.c
+ ./wirecheck >> wiretest.c
-include $(top_srcdir)/Rules
+mount.lustre$(EXEEXT): llmount
+ cp $< $@