# wmbackground Makefile

PREFIX=/usr/local
PACKAGE=wmbackground-1.0.1

BINDIR=$(PREFIX)/bin
DOCDIR=$(PREFIX)/doc/$(PACKAGE)

CC = gcc
CCOPTIONS = -O2 -Wall
LIBDIR = -L/usr/X11R6/lib
LIBS   = -lXpm -lXext -lX11

APP = wmbackground
OBJS =  $(APP).o \
		../wmgeneral/wmgeneral.o \
		../wmgeneral/misc.o \
		../wmgeneral/list.o 

all: $(APP)

.c.o:
	$(CC) -c $(CCOPTIONS) $< -o $*.o

$(APP): $(OBJS)
	$(CC) -o $(APP) $^ $(LIBDIR) $(LIBS)

install: $(APP)
	strip $(APP)
	cp $(APP) $(BINDIR)
	chown root.root $(APP)
	chmod 755 $(APP)
	if [ ! -d $(DOCDIR) ]; then install -d $(DOCDIR); fi
	cp -p ../COPYING ../ChangeLog ../README ../README.sunwait ../THANKS $(DOCDIR)
	if [ ! -d $(DOCDIR)/contrib ]; then mkdir $(DOCDIR)/contrib; fi
	cp -p ../contrib/* $(DOCDIR)/contrib

clean::
	for i in $(OBJS) ; do \
	rm -f $$i;\
	done
	rm -f $(APP)

uninstall:
	rm -f $(BINDIR)/wmbackground
	rm -f $(DOCDIR)/COPYING $(DOCDIR)/ChangeLog $(DOCDIR)/README $(DOCDIR)/README.sunwait $(DOCDIR)/THANKS $(DOCDIR)/contrib/*
	if [ -d $(DOCDIR)/contrib ]; then rmdir $(DOCDIR)/contrib; fi
	if [ -d $(DOCDIR) ]; then rmdir $(DOCDIR); fi

