# makefile for Gambit REPL app.

# Copyright (c) 1994-2016 by Marc Feeley, All Rights Reserved.

herefromroot = contrib/GambitREPL
rootfromhere = ../..
SUBDIRS =

PACKAGE_SHORTNAME = @PACKAGE_SHORTNAME@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_TARNAME = @PACKAGE_TARNAME@

@SET_MAKE@

srcdir = @srcdir@
VPATH = @srcdir@
srcdirpfx = @srcdirpfx@

C_COMPILER = @C_COMPILER_MF@
C_PREPROC = @C_PREPROC_MF@
FLAGS_OBJ = @FLAGS_OBJ_MF@
FLAGS_DYN = @FLAGS_DYN_MF@
FLAGS_LIB = @FLAGS_LIB_MF@
FLAGS_EXE = @FLAGS_EXE_MF@
DEFS = @DEFS@
LIBS = @LIBS@

GAMBITLIB_DEFS = @GAMBITLIB_DEFS_MF@
LIB_PREFIX = @LIB_PREFIX@
LIB_VERSION_SUFFIX = @LIB_VERSION_SUFFIX@
LIB_MAJOR_VERSION_SUFFIX = @LIB_MAJOR_VERSION_SUFFIX@

LIB_EXTENSION = @LIB_EXTENSION@
GAMBITLIB = @GAMBITLIB@
GAMBITGSCLIB = @GAMBITGSCLIB@
GAMBITGSILIB = @GAMBITGSILIB@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_LIB = @INSTALL_LIB@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
LN_S = @LN_S@
RANLIB = @RANLIB@
AR = @AR@
RC = @RC@
GIT = @GIT@
HG = @HG@

prefix = @prefix@
exec_prefix = @exec_prefix@
includedir = @includedir@
libdir = @libdir@
bindir = @bindir@
docdir = @docdir@
infodir = @infodir@
emacsdir = @emacsdir@
libexecdir = @libexecdir@
datarootdir = @datarootdir@
datadir = @datadir@
htmldir = @htmldir@
dvidir = @dvidir@
pdfdir = @pdfdir@
psdir = @psdir@
localedir = @localedir@
mandir = @mandir@

.SUFFIXES: .scm .m @obj@

MODULES_M = digest.m genport.m zlib.m tar.m json.m url.m html.m \
wiki.m repl-server.m intf.m script.m repo.m help.m emacs.m \
program.m program_.m

RCFILES = makefile.in README GambitREPL.xcodeproj.tgz emacs.tgz \
GambitREPL-icon-unscaled.key NotEmacs-icon-unscaled.key \
digest.scm "digest\#.scm" genport.scm "genport\#.scm" \
zlib.scm "zlib\#.scm" tar.scm "tar\#.scm" \
json.scm "json\#.scm" url.scm "url\#.scm" html.scm "html\#.scm" \
wiki.scm "wiki\#.scm" repl-server.scm "repl-server\#.scm" \
intf.scm "intf\#.scm" intf.h script.scm "script\#.scm" \
repo.scm "repo\#.scm" help.scm "help\#.scm" emacs.scm "emacs\#.scm" program.scm \
main.m grd.scm Prefix.pch \
AppDelegate.m AppDelegate.h ViewController.m ViewController.h \
KOCreateButton.h KOCreateButton.m KOKeyboardRow.h KOKeyboardRow.m \
KOProtocol.h KOSwipeButton.h KOSwipeButton.m \
TView.h TView.m WView.h WView.m IView.h IView.m ITView.h ITView.m \
GambitREPL.entitlements GambitREPL.plist GambitREPL.storyboard \
GambitREPL-29.png GambitREPL-40.png GambitREPL-57.png GambitREPL-72.png \
GambitREPL-76.png GambitREPL-87.png GambitREPL-120.png GambitREPL-152.png \
GambitREPL-180.png GambitREPL-512.png GambitREPL-1024.png \
NotEmacs.entitlements NotEmacs.plist NotEmacs.storyboard \
NotEmacs-29.png NotEmacs-40.png NotEmacs-57.png NotEmacs-72.png \
NotEmacs-76.png NotEmacs-87.png NotEmacs-120.png NotEmacs-152.png \
NotEmacs-180.png NotEmacs-512.png NotEmacs-1024.png \
Default-568h@2x.png \
edit.png f1.png f10.png f11.png f12.png f2.png f3.png \
f4.png f5.png f6.png f7.png f8.png f9.png note.png rocket.png \
stop.png user.png \
button-abc.png button-cancel.png button-compass.png button-empty.png \
button-left-left.png button-left.png button-question.png button-right-right.png \
button-right.png button-up.png button-up-arrow.png \
make-appstore-screenshots make-keys make-scaled-icons \
help.html r5rs.html r5rs.pdf gambit.html

GENDISTFILES =

DISTFILES = $(RCFILES) $(GENDISTFILES)

all:

all-pre:

all-post:

ios: grd@exe@ prepare-for-xcode

gambit-iOS:
	@echo "*************************************************************"
	@echo "*                                                           *"
	@echo "* Building Gambit for iOS                                   *"
	@echo "*                                                           *"
	@echo "*   This builds the Gambit runtime library for              *"
	@echo "*   the iPhone/iPad/iPod Touch devices and simulators       *"
	@echo "*                                                           *"
	@echo "*************************************************************"
	$(rootfromhere)/misc/build-gambit-iOS

prepare-for-xcode: $(MODULES_M) GambitREPL.xcodeproj gambit-iOS
	rm -rf lib
	mkdir lib
	cp gambit-iOS/current/lib/*.scm lib
	cp gambit-iOS/current/doc/gambit.pdf .
	if test ! -e "emacs"; then \
	  tar zxf emacs.tgz; \
	fi
	@echo "*************************************************************"
	@echo "*                                                           *"
	@echo "* To complete the iOS example the following steps must be   *"
	@echo "* completed manually:                                       *"
	@echo "*                                                           *"
	@echo "*  1) open GambitREPL.xcodeproj in XCode 4.0 (or later)     *"
	@echo "*                                                           *"
	@echo "*  2) select the appropriate target (simulator or device)   *"
	@echo "*                                                           *"
	@echo "*  3) select menu Product -> Run                            *"
	@echo "*                                                           *"
	@echo "*************************************************************"

.scm.m:
	@SETDLPATH@ $(rootfromhere)/gsc/gsc -:~~bin=$(srcdirpfx)$(rootfromhere)/bin,~~lib=$(srcdirpfx)$(rootfromhere)/lib,~~include=$(srcdirpfx)$(rootfromhere)/include -f -warnings -c -check -o $*.m $(srcdirpfx)$*.scm

program_.m: digest.m genport.m zlib.m tar.m json.m url.m html.m wiki.m repl-server.m intf.m script.m repo.m help.m emacs.m program.m
	@SETDLPATH@ $(rootfromhere)/gsc/gsc -:~~bin=$(srcdirpfx)$(rootfromhere)/bin,~~lib=$(srcdirpfx)$(rootfromhere)/lib,~~include=$(srcdirpfx)$(rootfromhere)/include -f -warnings -link -o $@ $^

GambitREPL.xcodeproj: GambitREPL.xcodeproj.tgz
	rm -rf GambitREPL.xcodeproj
	tar zxf GambitREPL.xcodeproj.tgz

tgz-for-GambitREPL.xcodeproj: GambitREPL.xcodeproj/project.pbxproj
	COPYFILE_DISABLE=1 tar cf GambitREPL.xcodeproj.tar GambitREPL.xcodeproj
	gzip -9 GambitREPL.xcodeproj.tar
	mv GambitREPL.xcodeproj.tar.gz GambitREPL.xcodeproj.tgz

tgz-for-emacs: emacs/GambitREPL.html emacs/GambitREPL.js emacs/GambitREPL.css emacs/common.js emacs/v1
	COPYFILE_DISABLE=1 tar cf emacs.tar emacs/GambitREPL.css emacs/GambitREPL.html emacs/GambitREPL.js emacs/common.js emacs/v1 emacs/icon.png emacs/ymacs/*
	gzip -9 emacs.tar
	mv emacs.tar.gz emacs.tgz

tgz-files: tgz-for-GambitREPL.xcodeproj tgz-for-emacs

grd@exe@: grd.scm
	@SETDLPATH@ $(rootfromhere)/gsc/gsc -:~~bin=$(srcdirpfx)$(rootfromhere)/bin,~~lib=$(srcdirpfx)$(rootfromhere)/lib,~~include=$(srcdirpfx)$(rootfromhere)/include -f -warnings -o grd@exe@ -exe grd.scm

bootstrap-pre:

bootstrap-post:

install-pre:

install-post: all

uninstall-pre:

uninstall-post:

select-gen-for-commit-pre:

select-gen-for-commit-post:

deselect-gen-for-commit-pre:

deselect-gen-for-commit-post:

mostlyclean-pre:

mostlyclean-post:
	rm -f $(MODULES_M) grd@exe@

clean-pre: mostlyclean-pre

clean-post: mostlyclean-post
	rm -f *.gcov *.gcno *.gcda

distclean-pre: clean-pre

distclean-post: clean-post

bootclean-pre: distclean-pre

bootclean-post: distclean-post

realclean-pre: bootclean-pre

realclean-post: bootclean-post
	rm -f makefile

rc-setup-pre:
	$(RC) add $(RCFILES)

rc-setup-post:

dist-pre dist-devel-pre:
	mkdir $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot)
	chmod 777 $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot)
	@echo "  Copying distribution files:"
	@for file in $(DISTFILES); do \
	  echo "    $(herefromroot)/$$file"; \
	  ln $(srcdirpfx)$$file $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot) 2> /dev/null \
	    || cp -p $(srcdirpfx)$$file $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot); \
	done

dist-post dist-devel-post:

all-recursive bootstrap-recursive install-recursive uninstall-recursive select-gen-for-commit-recursive deselect-gen-for-commit-recursive mostlyclean-recursive clean-recursive distclean-recursive bootclean-recursive realclean-recursive rc-setup-recursive dist-recursive dist-devel-recursive:
	@if test -n "$(SUBDIRS)"; then \
	  for subdir in ""$(SUBDIRS); do \
	    target=`echo $@ | sed 's/-recursive//'`; \
	    echo making $$target in $$subdir; \
	    (cd $$subdir && $(MAKE) $$target) || exit 1; \
	  done \
	fi

all: all-post

all-post: all-recursive

all-recursive: all-pre

bootstrap: bootstrap-post

bootstrap-post: bootstrap-recursive

bootstrap-recursive: bootstrap-pre

install: install-post

install-post: install-recursive

install-recursive: install-pre

uninstall: uninstall-post

uninstall-post: uninstall-recursive

uninstall-recursive: uninstall-pre

select-gen-for-commit: select-gen-for-commit-post

select-gen-for-commit-post: select-gen-for-commit-recursive

select-gen-for-commit-recursive: select-gen-for-commit-pre

deselect-gen-for-commit: deselect-gen-for-commit-post

deselect-gen-for-commit-post: deselect-gen-for-commit-recursive

deselect-gen-for-commit-recursive: deselect-gen-for-commit-pre

mostlyclean: mostlyclean-post

mostlyclean-post: mostlyclean-recursive

mostlyclean-recursive: mostlyclean-pre

clean: clean-post

clean-post: clean-recursive

clean-recursive: clean-pre

distclean: distclean-post

distclean-post: distclean-recursive

distclean-recursive: distclean-pre

bootclean: bootclean-post

bootclean-post: bootclean-recursive

bootclean-recursive: bootclean-pre

realclean: realclean-post

realclean-post: realclean-recursive

realclean-recursive: realclean-pre

rc-setup: rc-setup-post

rc-setup-post: rc-setup-recursive

rc-setup-recursive: rc-setup-pre

dist: dist-post

dist-post: dist-recursive

dist-recursive: dist-pre

dist-devel: dist-devel-post

dist-devel-post: dist-devel-recursive

dist-devel-recursive: dist-devel-pre

makefile: makefile.in $(rootfromhere)/config.status
	cd $(rootfromhere) && CONFIG_FILES=$(herefromroot)/$@ CONFIG_HEADERS= ./config.status

# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
