# Copyright (C) 1996,1997 Robert H”hne, see COPYING.RH for details 
# This file is part of RHIDE. 

srcdir=$(RHIDESRC)/tvpatch
VPATH=$(srcdir)

project=tvpatch
po_files=
src_files=$(po_files) tvpatch.mak tvpatch.gpr tvpatch.c makefile \
	makefile.src rhide.env rhide.var

update_files=tvpatch.gpr tvpatch.mak
cfg_files=tvpatch.gpr tvpatch.mak

subdirs=
po_subdirs=

TV2_SRC=$(RHIDESRC)/tv2_src
TV2_DIFF=$(RHIDESRC)/tvdiffs
TV2_NEW=$(RHIDESRC)/tvision
ifeq ($(TV2_SRC_ZIP),)
TV2_SRC_ZIP=$(TV2_SRC)/tv.zip
endif

include $(RHIDESRC)/common.mak

all:: tvpatch.exe

$(TV2_SRC)/TV.H: $(TV2_SRC)/Include.zip
	cd $(TV2_SRC); unzip -n -a Include.zip; cd $(obj_dir)

$(TV2_SRC)/TWINDOW.CPP: $(TV2_SRC)/Source.zip
	cd $(TV2_SRC); unzip -n -a Source.zip "*.CPP"; cd $(obj_dir)

$(TV2_SRC)/Include.zip $(TV2_SRC)/Source.zip: $(TV2_SRC_ZIP)
	cd $(TV2_SRC); unzip -n $(TV2_SRC_ZIP) $(notdir $@); cd $(obj_dir)

tvpatch.exe:: $(TV2_SRC)/TV.H $(TV2_SRC)/TWINDOW.CPP

make_dirs:
	$(INSTALL_DIR) $(TV2_DIFF)
	$(INSTALL_DIR) $(TV2_NEW)

diffs: tvpatch.exe
	rm -rf $(TV2_DIFF)
	$(INSTALL_DIR) $(TV2_DIFF)
	./tvpatch.exe -diff -ob $(TV2_SRC) -db $(TV2_DIFF) -pb $(TV2_NEW)

patches: tvpatch.exe
	$(INSTALL_DIR) $(TV2_NEW)
	./tvpatch.exe -patch -ob $(TV2_SRC) -db $(TV2_DIFF) -pb $(TV2_NEW)
