## Process this file with automake to produce Makefile.in
#
-# $Id: Makefile.am,v 1.74 2005/11/29 18:22:51 chrfranke Exp $
+# $Id: Makefile.am,v 1.79 2006/08/09 20:40:19 chrfranke Exp $
#
@SET_MAKE@
+# Make sure .cpp takes precedence to avoid compiling old .c file
+SUFFIXES = .cpp .c .s .o
+
+
AM_CPPFLAGS = -DSMARTMONTOOLS_SYSCONFDIR=\"$(sysconfdir)\"
sbin_PROGRAMS = smartd \
smartctl
-smartd_SOURCES = smartd.c \
- smartd.h \
- atacmdnames.c \
- atacmdnames.h \
- atacmds.c \
- atacmds.h \
- ataprint.c \
- ataprint.h \
- extern.h \
- int64.h \
- knowndrives.c \
- knowndrives.h \
- scsicmds.c \
- scsicmds.h \
- scsiprint.c \
- scsiprint.h \
- utility.c \
+smartd_SOURCES = smartd.cpp \
+ smartd.h \
+ atacmdnames.cpp \
+ atacmdnames.h \
+ atacmds.cpp \
+ atacmds.h \
+ ataprint.cpp \
+ ataprint.h \
+ extern.h \
+ int64.h \
+ knowndrives.cpp \
+ knowndrives.h \
+ scsicmds.cpp \
+ scsicmds.h \
+ scsiata.cpp \
+ scsiata.h \
+ scsiprint.cpp \
+ scsiprint.h \
+ utility.cpp \
utility.h
smartd_LDADD = @os_deps@ @os_libs@
smartd_DEPENDENCIES = @os_deps@
-EXTRA_smartd_SOURCES = os_darwin.c \
- os_darwin.h \
- os_linux.c \
+
+EXTRA_smartd_SOURCES = os_darwin.cpp \
+ os_darwin.h \
+ os_linux.cpp \
os_linux.h \
- os_freebsd.c \
- os_freebsd.h \
- os_netbsd.c \
- os_netbsd.h \
- os_openbsd.c \
- os_openbsd.h \
- os_solaris.c \
- os_solaris.h \
- os_solaris_ata.s \
- os_win32.c \
- os_generic.c \
- os_generic.h
+ os_freebsd.cpp \
+ os_freebsd.h \
+ os_netbsd.cpp \
+ os_netbsd.h \
+ os_openbsd.cpp \
+ os_openbsd.h \
+ os_solaris.cpp \
+ os_solaris.h \
+ os_solaris_ata.s \
+ os_win32.cpp \
+ os_generic.cpp \
+ os_generic.h
if OS_WIN32_MINGW
-smartd_SOURCES += \
- posix/regex.h \
- posix/regex.c \
- os_win32/daemon_win32.h \
- os_win32/daemon_win32.c \
- os_win32/hostname_win32.h \
- os_win32/hostname_win32.c \
- os_win32/syslog.h \
- os_win32/syslog_win32.c
+smartd_SOURCES += \
+ posix/regex.h \
+ posix/regex.c \
+ os_win32/daemon_win32.h \
+ os_win32/daemon_win32.cpp \
+ os_win32/hostname_win32.h \
+ os_win32/hostname_win32.cpp \
+ os_win32/syslog.h \
+ os_win32/syslog_win32.cpp
# Included by regex.c:
EXTRA_smartd_SOURCES += \
endif
-smartctl_SOURCES= smartctl.c \
- smartctl.h \
- atacmdnames.c \
- atacmdnames.h \
- atacmds.c \
- atacmds.h \
- ataprint.c \
- ataprint.h \
- extern.h \
- int64.h \
- knowndrives.c \
- knowndrives.h \
- scsicmds.c \
- scsicmds.h \
- scsiprint.c \
- scsiprint.h \
- utility.c \
+smartctl_SOURCES= smartctl.cpp \
+ smartctl.h \
+ atacmdnames.cpp \
+ atacmdnames.h \
+ atacmds.cpp \
+ atacmds.h \
+ ataprint.cpp \
+ ataprint.h \
+ extern.h \
+ int64.h \
+ knowndrives.cpp \
+ knowndrives.h \
+ scsicmds.cpp \
+ scsicmds.h \
+ scsiata.cpp \
+ scsiata.h \
+ scsiprint.cpp \
+ scsiprint.h \
+ utility.cpp \
utility.h
smartctl_LDADD = @os_deps@ @os_libs@
smartctl_DEPENDENCIES = @os_deps@
-EXTRA_smartctl_SOURCES = os_linux.c \
- os_linux.h \
- os_freebsd.c \
- os_freebsd.h \
- os_netbsd.c \
- os_netbsd.h \
- os_openbsd.c \
- os_openbsd.h \
- os_solaris.c \
- os_solaris.h \
- os_win32.c \
- os_generic.c \
- os_generic.h
+
+EXTRA_smartctl_SOURCES = os_linux.cpp \
+ os_linux.h \
+ os_freebsd.cpp \
+ os_freebsd.h \
+ os_netbsd.cpp \
+ os_netbsd.h \
+ os_openbsd.cpp \
+ os_openbsd.h \
+ os_solaris.cpp \
+ os_solaris.h \
+ os_win32.cpp \
+ os_generic.cpp \
+ os_generic.h
if OS_WIN32_MINGW
os_darwin/SMART.in \
os_darwin/StartupParameters.plist \
os_darwin/English_Localizable.strings \
+ os_win32/installer.nsi \
$(docs_DATA)
CLEANFILES = smartd.conf.5 \
#MAN2HTML = groff -man -Thtml
MAN2TXT = groff -man -Tascii -P'-bcou'
-# Fix links in man2html output
-FIXHTML = sed 's,<A HREF="http://[-a-z/]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
+# Remove HTTP header and fix links in man2html output
+FIXHTML = sed '1s,^Content-type.*,,' \
+ | sed 's,<A HREF="http://[-a-z/]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
| sed 's,<A HREF="http://[-a-z/]*/man2html">,<A HREF=".">,g' \
| sed 's,<A HREF="http://[-a-z/]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
| sed 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
txtman: smartctl.8.txt smartd.8.txt smartd.conf.5.txt
+if OS_WIN32_MINGW
+
+%.5.html: %.5
+ $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
+
+%.8.html: %.8
+ $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
+else
+
%.5.html: %.5
$(MAN2HTML) $< | $(FIXHTML) > $@
%.8.html: %.8
$(MAN2HTML) $< | $(FIXHTML) > $@
+endif
%.5.txt: %.5
$(MAN2TXT) $< > $@
distdir_win32 = $(PACKAGE)-$(VERSION).win32
distzip_win32 = $(PACKAGE)-$(VERSION).win32.zip
+distinst_win32= $(PACKAGE)-$(VERSION).win32-setup.exe
exedir_win32 = $(distdir_win32)/bin
docdir_win32 = $(distdir_win32)/doc
# Textfile converter from cygutils
UNIX2DOS = unix2dos -D
+DOS2UNIX = dos2unix -U
# Build Windows distribution
dist-win32: $(distzip_win32)
+install-win32: $(distinst_win32)
+ ./$(distinst_win32)
+
+installer-win32: $(distinst_win32)
+
distdir-win32: distdir.mkdir $(FILES_WIN32) syslogevt.check
$(distzip_win32): distdir.mkdir $(FILES_WIN32) syslogevt.check
@rm -fv $(distzip_win32)
cd $(distdir_win32) && zip -9Dr ../$(distzip_win32) .
+# Build NSIS installer, try to locate makensis in default location first
+$(distinst_win32): $(srcdir)/os_win32/installer.nsi distdir.mkdir $(FILES_WIN32) syslogevt.check
+ @makensis="$(MAKENSIS)"; if [ -z "$$makensis" ]; then \
+ if [ ! -z "$$PROGRAMFILES" ] && "$$PROGRAMFILES/NSIS/makensis" /VERSION >/dev/null 2>&1; then \
+ makensis="$$PROGRAMFILES/NSIS/makensis"; \
+ elif makensis /VERSION >/dev/null 2>&1; then \
+ makensis=makensis; \
+ else \
+ echo 'makensis: command not found. Please download and install NSIS' 1>&2; \
+ echo 'from http://nsis.sourceforge.net/Download' 1>&2; exit 1; \
+ fi; \
+ fi; \
+ echo "$$makensis /V2 /NOCD /DINPDIR=$(distdir_win32) /DOUTFILE=$(distinst_win32) $(srcdir)/os_win32/installer.nsi"; \
+ "$$makensis" /V2 /NOCD /DINPDIR="$(distdir_win32)" /DOUTFILE="$(distinst_win32)" "$(srcdir)/os_win32/installer.nsi"
+
cleandist-win32:
rm -rf $(distdir_win32) distdir.mkdir syslogevt.check
$(srcdir)/os_win32/config_vc6.h: config.h
sed '1i/* config_vc6.h. Generated by Makefile. */' $< | \
- sed 's,^#define HAVE_\(ATTR_PACKED\|INTTYPES_H\|STDINT_H\|STRTOULL\|U*INT64_T\|UNISTD_H\) 1$$,/* #undef HAVE_\1 */,' | \
+ sed 's,^#define HAVE_\(ATTR_PACKED\|INTTYPES_H\|STDINT_H\|STRINGS_H\|STRTOULL\|U*INT64_T\|UNISTD_H\) 1$$,/* #undef HAVE_\1 */,' | \
sed 's,i.86-pc-mingw32,i686-pc-win32vc6,' > $@
endif