CFLAGS   = -O3 -Wall  

# There should be nothing to edit below this line
# -----------------------------------------------------------------------------
CC			= gcc

XROOT    = /usr/X11R6
INCLPATH = -I$(XROOT)/include
LDPATH   = -L$(XROOT)/lib

BGOBJS   = swmbg.o 

all: clean swmbg
	rm -f *.o 

swmbg: $(BGOBJS)
	$(CC) -s -pipe -msmall $(DEFINES) $(LDPATH) -lX11 -lXext -lXpm $(BGOBJS) -o $@

$(BGOBJS): %.o: %.c $(HEADERS)
	$(CC) -c $(CFLAGS) $(DEFINES) $(INCLPATH) $<

install: all
	rm -f $(XROOT)/man/man1/swmbg*
	cp -f swmbg.1x $(XROOT)/man/man1
	cp -f swmbg-de.1x $(XROOT)/man/man1
	gzip -f -9 $(XROOT)/man/man1/swmbg.1x
	gzip -f -9 $(XROOT)/man/man1/swmbg-de.1x
	cp -v -f -r pixmaps/ /usr/share/swm/

rpm-build: all
	install -s swmbg ../../rpm-build$(XROOT)/bin
	rm -f ../../rpm-build/$(XROOT)man/man1/swmbg*
	cp -f swmbg.1x ../../rpm-build$(XROOT)/man/man1
	cp -f swmbg-de.1x ../../rpm-build$(XROOT)/man/man1
	gzip -f -9 ../../rpm-build$(XROOT)/man/man1/swmbg.1x
	gzip -f -9 ../../rpm-build$(XROOT)/man/man1/swmbg-de.1x
	cp -v -f -r pixmaps/ ../../rpm-build/usr/share/swm/

uninstall: all
	rm $(XROOT)/bin/swmbg 
	rm $(XROOT)/man/man1/swmbg*

clean:
	rm -f *~ swmbg core *.o $(BGOBJS)
