#
#       Makefile for fonts
#
#       Copyright (C) 2000-2022 GFD Dennou Club. All rights reserved.
#

ROOTDIR     = ..\..\..
OBJDIR      = ..

FSRC        = cvfont.f

FOBJ = $(FSRC:.f=.obj)

!include $(ROOTDIR)\MkInclude.win

MAPDATAF	= coast_world.asc          border_world.asc          \
		  plate_world.asc          state_usa.asc             \
		  coast_japan.asc          pref_japan.asc
MAPDATAB	= coast_world              border_world              \
		  plate_world              state_usa                 \
		  coast_japan              pref_japan
MAPDATAI	= coast_world border_world plate_world state_usa    \
		  coast_japan pref_japan
MAPDATAFR	= coast_world_1.asc
MAPDATABR	= coast_world_1

CVMAPD		= cvmapd
RMAPD1		= rmapd1

build:
    $(MAKE) /$(MAKEFLAGS) /NOLOGO /S /f makefile.win subdirs \
            SUBDIRS_PRETARGET=build-exec
build-exec: $(MAPDATAI) $(MAPDATABR)

install:
    $(MAKE) /$(MAKEFLAGS) /NOLOGO /S /f makefile.win subdirs \
            SUBDIRS_PRETARGET=install-exec
install-exec-unique:
	$(CP) coast_world $(DSPATH)
	$(CP) border_world $(DSPATH)
	$(CP) plate_world $(DSPATH)
	$(CP) state_usa $(DSPATH)
	$(CP) coast_japan $(DSPATH)
	$(CP) pref_japan $(DSPATH)
	$(CP) coast_world_1 $(DSPATH)

clean:
    $(MAKE) /$(MAKEFLAGS) /NOLOGO /S /f makefile.win subdirs \
            SUBDIRS_PRETARGET=clean-exec
clean-exec-unique:
    @IF EXIST *.obj $(RM)  *.obj
    @IF EXIST *.exe $(RM)  *.exe

coast_world: coast_world.asc $(CVMAPD).exe
	echo "Creating map data $@"
	$(RM) $@
	echo '$@.asc' '$@' | $(CVMAPD).exe

coast_world_1: coast_world_1.asc $(CVMAPD).exe
	@echo "Creating map data $@"
	@$(RM) $@
	@echo '$@.asc' '$@' | $(CVMAPD).exe

border_world: border_world.asc $(CVMAPD).exe
	@echo "Creating map data $@"
	@$(RM) $@
	@echo '$@.asc' '$@' | $(CVMAPD).exe

plate_world: plate_world.asc $(CVMAPD).exe
	@echo "Creating map data $@"
	@$(RM) $@
	@echo '$@.asc' '$@' | $(CVMAPD).exe

state_usa: state_usa.asc $(CVMAPD).exe
	@echo "Creating map data $@"
	@$(RM) $@
	@echo '$@.asc' '$@' | $(CVMAPD).exe

coast_japan: coast_japan.asc $(CVMAPD).exe
	@echo "Creating map data $@"
	@$(RM) $@
	@echo '$@.asc' '$@' | $(CVMAPD).exe

pref_japan: pref_japan.asc $(CVMAPD).exe
	@echo "Creating map data $@"
	@$(RM) $@
	@echo '$@.asc' '$@' | $(CVMAPD).exe

$(CVMAPD).exe: $(CVMAPD).f
    ifort $(CVMAPD).f
   @IF EXIST *.obj $(RM)  *.obj


coast_world_1.asc: coast_world.asc $(RMAPD1).exe
	@echo "Creating sub-map data $@"
	@$(RM) $@
	@echo 'coast_world.asc' 'coast_world_1.asc' | $(RMAPD1).exe

$(RMAPD1).exe: $(RMAPD1).f
    ifort $(RMAPD1).f
    @IF EXIST *.obj $(RM)  *.obj
