# (c) Zdenek Kabelac 1999, Released under GPL
#
# Test source for phantom RTL driver
#

include ../phm.mk

CFLAGS += `gtk-config --cflags`
# -fverbose-asm

DSTS = ph_reset iobases speed pol_sim test2 test_tah print odpor trilin_rtf
# trilin  barrier trl_tst readiomem \
# tr_test texture pointer pol_drag gui
SRCS = $(DSTS)

TARGETS = $(DSTS) dr_test trl_tst vgatest height_map

SRC = $(TARGET:.o=.c)
HDR = $(TARGET:.o=.h)

LOADLIBES = -lm -lpthread -L../libphantom -lphantom

# O1
# -fthread-jumps -march=pentium
# O2
# -fstrength-reduce -fschedule-insns2
# -fcse-follow-jumps -frerun-cse-after-loop 
# -fexpensive-optimizations

SOURCE = #-S

all: $(TARGETS)

dr_test: dr_test.o 
	$(CC) -o $@ dr_test.o $(LOADLIBES)

trl_tst.o: trl_tst.c
	$(CC) -O1 -fthread-jumps -march=pentium -o $@ -c $<

height: height.o
	rm -f height
	$(CC) -o $@ height.o -lglut -lGLU -lGL -L/usr/X11R6/lib -lICE -lX11 -lXmu -lXext -lm

height_map: height_map.o
	rm -f height_map
	$(CC) -o $@ height_map.o $(LOADLIBES) -lglut -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXext -lm 

trl_tst: trl_tst.o
	$(CC) -o $@ trl_tst.o -lm

GUIOBJS = gui_gtk.o

gui: $(GUIOBJS)
	$(CC) $(CFLAGS) -o $@ $(GUIOBJS) `gtk-config --libs`

clean:
	@echo -n "Cleaning... "
	@$(RM) -f $(addsuffix .o,$(SRCS)) $(TARGETS) *~
	@$(RM) -f core `find . -name '*.[oas]' -o -name '*~'` 
	@echo "done"

