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

SWOBJS   = swmswitch.o 

all: swmswitch
	rm -f *.o

swmswitch: $(SWOBJS)
	$(CC) -s -pipe -msmall $(DEFINES) $(LDPATH) -lX11 $(SWOBJS) -o $@

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

install: all 
	rm -f $(XROOT)/man/man1/swmswitch*
	cp -f swmswitch.1x $(XROOT)/man/man1
	gzip -f -9 $(XROOT)/man/man1/swmswitch.1x
	install -s swmswitch $(XROOT)/bin

rpm-build: all
	install -s swmswitch ../../rpm-build$(XROOT)/bin
	rm -f ../../rpm-build/$(XROOT)man/man1/swmswitch*
	cp -f swmswitch.1x ../../rpm-build$(XROOT)/man/man1
	gzip -f -9 ../../rpm-build$(XROOT)/man/man1/swmswitch.1x

uninstall: 
	rm -f $(XROOT)/bin/swmswitch 
	rm -f $(XROOT)/man/man1/swmswitch*

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