Main change is to use $(INSTALL) instead of cp in install target along with
$(DESTDIR) variable.  We also remove installation of user ~/.wmppprc config
file -- this isn't useful for sysadmins or package maintainers.

We also update INSTALL to reflect the changes.
---
 wmppp.app/INSTALL  |  7 +++++--
 wmppp.app/Makefile | 44 ++++++++++++++++++++++++++------------------
 2 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/wmppp.app/INSTALL b/wmppp.app/INSTALL
index 5a8e798..ae4805e 100644
--- a/wmppp.app/INSTALL
+++ b/wmppp.app/INSTALL
@@ -38,8 +38,9 @@ up pppd's configuration files, but do want them to be able
 to make a dialup connection, a sample system.rc file is
 included (system.wmppprc), please take a look at it!
 
-The installation will install standard rc files in $HOME
-and /etc/ WITHOUT the 'force' option!
+The installation will install a standard rc file in /etc
+WITHOUT the 'force' option!  You can also create one in
+$HOME (~/.wmpprc).
 
 How it works:
 
@@ -75,6 +76,8 @@ General Notes
 Note 1: If "make install" fails on your system, please edit
         the Makefile to set the paths according to your setup.
         Make install defaults to /usr/local/bin & /etc/ppp/.
+       You may also change these directories using the various
+       variables, e.g., make PREFIX=/usr.
 
 Note 2: Please DO read the HINTS, this file contains some
         very useful tips and hints about WMPPP.
diff --git a/wmppp.app/Makefile b/wmppp.app/Makefile
index c1fcce4..ffa7ace 100644
--- a/wmppp.app/Makefile
+++ b/wmppp.app/Makefile
@@ -1,36 +1,44 @@
-LIBDIR = -L/usr/X11R6/lib
 LIBS   = -lXpm -lXext -lX11
-CFLAGS += -O2
 OBJS  = wmppp.o \
                wmgeneral/wmgeneral.o \
                wmgeneral/misc.o \
                wmgeneral/list.o
 
-.c.o:
-       cc -g -c $(CPPFLAGS) $(CFLAGS) -Wall $< -o $*.o
+INSTALL = install
+INSTALL_PROGRAM = $(INSTALL)
+INSTALL_DATA = $(INSTALL) -m 644
 
-wmppp: $(OBJS)
-       cc -o wmppp $(LDFLAGS) $^ -lXext $(LIBDIR) $(LIBS)
+PREFIX = /usr/local
+BINDIR = $(PREFIX)/bin
+LIBDIR = $(PREFIX)/lib/wmppp.app
+SYSCONFDIR = /etc
+MANDIR = $(PREFIX)/share/man/man1
 
 all:: wmppp getmodemspeed
 
+%.o: %.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+
+wmppp: $(OBJS)
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+getmodemspeed: getmodemspeed.o
+       $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+
 clean::
        for i in $(OBJS) ; do \
                rm -f $$i; \
        done
+       rm -f getmodemspeed.o
        rm -f wmppp getmodemspeed
 
 install::
-
-       cp -f wmppp /usr/local/bin/
-       chmod 755 /usr/local/bin/wmppp
-       chown root:root /usr/local/bin/wmppp
-       cp getmodemspeed /etc/ppp/
-       chmod 755 /etc/ppp/getmodemspeed
-       chown root.root /etc/ppp/getmodemspeed
-       cp -f user.wmppprc /etc/wmppprc
-       chmod 644 /etc/wmppprc
-       chown root.root /etc/wmppprc
-       cp -f user.wmppprc $(HOME)/.wmppprc
-       cp -f wmppp.1 /usr/local/share/man/man1
+       $(INSTALL) -d $(DESTDIR)$(BINDIR)
+       $(INSTALL_PROGRAM) wmppp $(DESTDIR)$(BINDIR)
+       $(INSTALL) -d $(DESTDIR)$(LIBDIR)
+       $(INSTALL_PROGRAM) getmodemspeed $(DESTDIR)$(LIBDIR)
+       $(INSTALL) -d $(DESTDIR)$(SYSCONFDIR)
+       $(INSTALL_DATA) user.wmppprc $(DESTDIR)$(SYSCONFDIR)/wmppprc
+       $(INSTALL) -d $(DESTDIR)$(MANDIR)
+       $(INSTALL_DATA) wmppp.1 $(DESTDIR)$(MANDIR)
        echo "WMPPP installation finished."
-- 
2.1.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to