[PATCH 09/11] wmtop: Switch build system to autotools.

Doug Torrance <[email protected]>
Newsgroups gmane.compw.window-managers.windowmaker.devel
Message-ID <[email protected]>
To take advantage of this, we rename CHANGES to ChangeLog and also replace
the WMTOP_VERSION macro with PACKAGE_VERSION.
---
 wmtop/{CHANGES => ChangeLog} |  0
 wmtop/Makefile               | 46 --------------------------------------------
 wmtop/Makefile.am            |  9 +++++++++
 wmtop/configure.ac           | 18 +++++++++++++++++
 wmtop/wmtop.c                |  4 +---
 5 files changed, 28 insertions(+), 49 deletions(-)
 rename wmtop/{CHANGES => ChangeLog} (100%)
 delete mode 100644 wmtop/Makefile
 create mode 100644 wmtop/Makefile.am
 create mode 100644 wmtop/configure.ac

diff --git a/wmtop/CHANGES b/wmtop/ChangeLog
similarity index 100%
rename from wmtop/CHANGES
rename to wmtop/ChangeLog
diff --git a/wmtop/Makefile b/wmtop/Makefile
deleted file mode 100644
index 8aa8087..0000000
--- a/wmtop/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-DEBUG  = -DPARANOID
-LIBDIR = -L/usr/X11R6/lib
-LIBS   = -lXpm -lXext -lX11 -ldockapp
-INCS   = -I/usr/X11R6/share/include -I/usr/X11R6/include
-OBJS   = wmtop.o
-OPTS   = -O3 -g -Wall
-FLAGS  = $(DEBUG) $(OPTS) -D$(OS)
-MAKE   = make
-CC     = cc
-PREFIX ?= /usr/local
-
-default:
-	@echo Use '"make os"' where '"os"' is one of:
-	@echo "    freebsd"
-	@echo "    linux"
-	@echo Then '"make install"'
-
-freebsd:
-	$(MAKE) OS=FREEBSD all
-
-linux:
-	$(MAKE) OS=LINUX all
-
-.c.o:
-	$(CC) $(FLAGS) $(INCS) -c $< -o $*.o
-
-wmtop: $(OBJS) wmtop.o
-	$(CC) $(FLAGS) -o wmtop $(OBJS) $(LIBDIR) $(LIBS)
-	@echo Now you can do a '"make install"'
-
-all: wmtop
-
-clean:
-	for i in $(OBJS) ; do \
-		rm -f $$i ; \
-	done
-	rm -f wmtop 
-	rm -f *~
-
-install: wmtop
-	strip wmtop
-	cp -f wmtop $(PREFIX)/bin/
-	chmod 755 $(PREFIX)/bin/wmtop
-	cp -f wmtop.1 $(PREFIX)/man/man1
-	chmod 644 $(PREFIX)/man/man1/wmtop.1
-	@echo "wmtop Installation finished..."
diff --git a/wmtop/Makefile.am b/wmtop/Makefile.am
new file mode 100644
index 0000000..3c27300
--- /dev/null
+++ b/wmtop/Makefile.am
@@ -0,0 +1,9 @@
+bin_PROGRAMS = wmtop
+wmtop_SOURCES = wmtop.c xpm/wmtop-rainbow.xpm xpm/wmtop-neon1.xpm \
+	xpm/wmtop-default.xpm xpm/wmtop-neon2.xpm xpm/wmtop-lcd.xpm
+
+AM_CFLAGS = $(x11_CFLAGS) $(xext_CFLAGS) $(xpm_CFLAGS) $(dockapp_CFLAGS)
+LIBS += $(x11_LIBS) $(xext_LIBS) $(xpm_LIBS) $(dockapp_LIBS)
+
+dist_man_MANS = wmtop.1
+EXTRA_DIST = BUGS
diff --git a/wmtop/configure.ac b/wmtop/configure.ac
new file mode 100644
index 0000000..248ca48
--- /dev/null
+++ b/wmtop/configure.ac
@@ -0,0 +1,18 @@
+AC_INIT([wmtop], [0.84], [[email protected]])
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+AC_CONFIG_SRCDIR([configure.ac])
+AC_CANONICAL_HOST
+AS_CASE([$host_os],
+  [linux*],
+	[AC_DEFINE(LINUX)],
+  [*freebsd*],
+	[AC_DEFINE(FREEBSD)],
+  [AC_MSG_ERROR([unknown operating system "$host_os".])]
+)
+AC_PROG_CC
+PKG_CHECK_MODULES([x11],[x11])
+PKG_CHECK_MODULES([xext],[xext])
+PKG_CHECK_MODULES([xpm],[xpm])
+PKG_CHECK_MODULES([dockapp],[dockapp])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/wmtop/wmtop.c b/wmtop/wmtop.c
index afe7e24..a1c20c9 100644
--- a/wmtop/wmtop.c
+++ b/wmtop/wmtop.c
@@ -76,8 +76,6 @@
 /* Defines                                */
 /******************************************/
 
-#define WMTOP_VERSION "0.9"
-
 /*
  * XXX: I shouldn't really use this WMTOP_BUFLENGTH variable but scanf is so
  * lame and it'll take me a while to write a replacement.
@@ -1007,5 +1005,5 @@ void usage(void) {
 /******************************************/
 
 void printversion(void) {
-    fprintf(stderr, "wmtop v%s\n",WMTOP_VERSION);
+    fprintf(stderr, "wmtop v%s\n",PACKAGE_VERSION);
 }
-- 
2.5.0


-- 
To unsubscribe, send mail to [email protected].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.