LIB_DIR = /cs/research/mice/speedy/common/sun5/lib
LIBRARY_TCL = $(LIB_DIR)/tcl7.5
LIBRARY_TK = $(LIB_DIR)/tk4.1
TK_LIBRARY_FILES = \
                $(LIBRARY_TCL)/init.tcl \
                $(LIBRARY_TK)/tk.tcl \
                $(LIBRARY_TK)/bgerror.tcl \
                $(LIBRARY_TK)/button.tcl \
                $(LIBRARY_TK)/dialog.tcl \
                $(LIBRARY_TK)/entry.tcl \
                $(LIBRARY_TK)/focus.tcl \
                $(LIBRARY_TK)/listbox.tcl \
                $(LIBRARY_TK)/menu.tcl \
                $(LIBRARY_TK)/palette.tcl \
                $(LIBRARY_TK)/scale.tcl \
                $(LIBRARY_TK)/tearoff.tcl \
                $(LIBRARY_TK)/text.tcl \
                $(LIBRARY_TK)/optMenu.tcl $(LIBRARY_TK)/scrlbar.tcl

SRC_C_FILES = \
	../src/sd_listen.c \
	../src/bitmaps.c \
	../src/bus.c \
	../src/compat.c \
	../src/generate_ids.c \
	../src/iohandler.c \
	../src/random.c \
	../src/sdr_help.c \
	../src/sip.c \
	../src/tkUnixInit.c \
	../src/ui_fns.c \
	../src/ui_init.c \
	../src/win32.c \
	../src/www_fns.c

SDR_UI_FILES = \
		tcl_libs.c \
		tcl_generic.c \
		tcl_www.c \
		tcl_new.c \
		tcl_start_tools.c \
		tcl_parsed_plugins.c \
		tcl_plugins.c \
		tcl_sip.c \
		tcl_sdp.c \
		tcl_sdr.c

SDR_HELP_FILES = \
	mbone_faq.ehtml \
	mbone_tools.ehtml \
	bugs.ehtml \
	changes.ehtml \
	intro.ehtml \
	node1.ehtml \
	node2.ehtml \
	node3.ehtml \
	node4.ehtml \
	node5.ehtml \
	node6.ehtml \
	node7.ehtml \
	node8.ehtml \
	node9.ehtml \
	node10.ehtml \
	node11.ehtml \
	node12.ehtml \
	node13.ehtml \
	node14.ehtml \
	node15.ehtml \
	plugins.ehtml \
	plugtut.ehtml

CC = gcc
CFLAGS=$(INCLUDES) -DWIN32 -DCANT_MCAST_BIND -Wall

TCL2C = ./tcl2c -c

.SUFFIXES: .ehtml .html .tcl $(.SUFFIXES)

VPATH = ../src:../src/html

tcl_%.c: %.tcl
	rm -f $@; $(TCL2C) tcl_$* < $< > $@

%.ehtml: %.html
	rm -f $@; $(TCL2C) $* < $< > $@


SRCS = $(SRC_C_FILES) $(SDR_UI_FILES) $(SDR_HELP_FILES)

TARFILES = makefile.vc $(SRCS)


all:	../winsdr.tar

../winsdr.tar:	$(TARFILES)
	-ln -s ../src/*.[ch] ../src/*.xbm  .
	tar cfh ../winsdr.tar makefile.vc *.[ch] *.xbm *.ehtml

clean:
	rm -f ../winsdr.tar *.[ch] *.tcl *.xbm *.ehtml tcl2c

$(SDR_HELP_FILES): tcl2c
$(SDR_UI_FILES): tcl2c

tcl2c:	../src/tcl2c.c
	$(CC) $(CFLAGS) -o $@ ../src/tcl2c.c

libs.tcl: $(TK_LIBRARY_FILES)
	cat $(TK_LIBRARY_FILES) | sed '/^[      ]*source[       ]/d' > libs.tcl

parsed_plugins.tcl: ../src/plugin2tcl.tcl
	tclsh7.5 ../src/plugin2tcl.tcl
