#
# GRX test programs makefile for LINUX/X11. Uses GNU make.
#
.PHONY : clean setsuid

GRXVX11=y

include ../../makedefs.grx

INCDIR=  -I../../include

# Enable this line for static linked test progs (default)
GRX20X = ../../lib/$(GRX_LIB_SUBDIR)/libgrx20X.a
# or this if you've already installed the shared libs
#GRX20X = -L./../lib/$(GRX_LIB_SUBDIR) -lgrx20X

ifeq ($(SET_XSUIDROOT),y)
EXECBITS = 4755
else
EXECBITS = 0755
endif

ADDON_LIBS=

ifeq ($(USE_XF86DGA_DRIVER),y)
  ADDON_LIBS += -lXxf86dga -lXext
endif

#ifeq ($(HAVE_LIBTIFF),y)
#  ADDON_LIBS += -ltiff
#endif
#
#ifeq ($(HAVE_LIBJPEG),y)
#  ADDON_LIBS += -ljpeg
#endif
#
#ifeq ($(NEED_ZLIB),y)
#  ADDON_LIBS += -lz
#endif

LIBS= $(GRX20X) $(ADDON_LIBS) $(X11LIBS) -lm

PROGS=               \
	xbgilink     \
	xbccbgi      \
	xcolortst    \
	xfontplay    \
	xsmall       \
	xtellipse    \
	xtfill       \
	xtmodes      \
	xtpoly       \
	xttext

all: $(PROGS)

$(PROGS): x%: %.o $(GRX20X)
	$(CC) $(LDOPT) -o $@ $*.o $(LIBS)
	chmod $(EXECBITS) $@

$(PROGS:x%=%.o): %.o : %.c
	$(CC) -c $(CCOPT) -D__XWIN__ $(INCDIR) $*.c -o $*.o

setsuid: $(PROGS)
ifeq ($(SET_XSUIDROOT),y)
	chown root $(PROGS)
	chmod $(EXECBITS) $(PROGS)
else
	@echo "Nothing to do, SET_XSUIDROOT is not set to 'y' in makedefs.grx"
endif

.c.s:
	$(CC) -S $(CCOPT) $(INCDIR) $*.c

clean:
	rm -f *.o $(PROGS)

depend.new:
	$(CC) -MM $(CCOPT) $(INCDIR) $(PROGS:x%=%.c) > depend.new

#include depend.gnu
