#
# Makefile for win32 tools
#
# Kekoa Proudfoot
# 6/15/98
#

ROOT = ..
include $(ROOT)/make/shared.mk

CFLAGS   = -DWIN32 $(W32CFLAGS)
LFLAGS   = $(W32LFLAGS)

# O denotes other directory (../tools) - make links to these

OCHDRS   = clparse.h timer.h state.h
OCSRCS   = clparse.c timer.c state.c
OCOBJS   = $(OCSRCS:.c=.o)

OPROGS   = contexts copy counts dump extract offsets swap truncate skip \
	   version validate glplay tex filter texformats glmovie mipmap dcview
OTARGS   = $(OPROGS:=.exe)

OOBJS    = $(OTARGS:.exe=.o)
OSRCS    = $(OTARGS:.exe=.c)

# L denotes local directory (.) - don't make links to these

LPROGS   = 
LTARGS   = $(LPROGS:=.exe)

LOBJS    = $(LTARGS:.exe=.o)
LSRCS    = $(LTARGS:.exe=.c)

# Everything

COBJECTS = $(OCOBJS)

TARGETS  = $(OTARGS) $(LTARGS)
OBJECTS  = $(OCOBJS) $(OOBJS) $(LOBJS)

LINKS    = $(OCHDRS) $(OCSRCS) $(OSRCS)

# Hack!
INCS     = -I../wlib
LIBS     = ../wlib/libglt.lib libc.lib

WINLIBS  = user32.lib gdi32.lib opengl32.lib
#WINLIBS = oldnames.lib kernel32.lib ws2_32.lib mswsock.lib \
#          advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib \
#          opengl32.lib

all: $(LINKS) $(TARGETS)

$(TARGETS): $(COBJECTS) ../wlib/libglt.lib

CFLAGS_glplay = -DPROMPT
LIBS_glplay = $(WINLIBS)
LIBS_tex = $(WINLIBS)
LIBS_glmovie = $(WINLIBS) vfw32.lib
LIBS_dcview = $(WINLIBS)

$(LINKS): %: ../tools/%
	cp ../tools/$* .

clean:
	rm -f *~ $(OBJECTS) $(TARGETS) *.pdb

nolinks:
	rm -f $(LINKS)

install: $(TARGETS)
	mkdir -p $(INSTROOT)/wtools
	cp $(TARGETS) $(INSTROOT)/wtools

veryclean: clean nolinks

