Cmake = env LD_LIBRARY_PATH=../common:./common clisp make

.PHONY: all most clean install uninstall pages newpages manaul
.PHONY: dist newdist test maintainerclean

all:
	${Cmake} code
	${MAKE} -C lgc
	@echo
	@echo "------------------------------------------------------------"
	@echo
	@echo "To install:"
	@echo "> su"
	@echo "> make install"
	@echo

most:
	${Cmake} most
code:
	${Cmake} code
install:
	${Cmake} install
uninstall:
	${Cmake} uninstall
newpages:
	${Cmake} newpages
manual:
	${Cmake} manual
wrap:
	${Cmake} wrap
dist:
	${Cmake} dist
newdist:
	${Cmake} newdist
test:
	cd test;./test
newtest:
	cd lgc/build/testsuite;./test
verify: clean all newtest
clean:
	${Cmake} distclean

# Targets for making C-version (version 0.2+)
# make build:  Generate 0.2+ version and compare it with given 0.2+ version
# make bpages: Place a mirror of . in ./lgc/build/src/boot
#              That allows to regenerate 0.2+ from source
# make bmake:  Compile present 0.1.x version independently of config files
# make btest:  Run 0.1.x testsuite
# make bself:  Generate 0.2+ version using 0.1.x version
# make bdiff:  Compare generated and existing 0.2+ version

MIRROR=lgc/build/src/boot
build:	clean bmake btest bself bdiff
bpages:
	mkdir -p ${MIRROR}/lgc/build/src
	cp -r common ${MIRROR}
	cp logiweb.conf ${MIRROR}
	cp makefile ${MIRROR}
	cp make.lisp ${MIRROR}
	cp lgc/makefile ${MIRROR}/lgc
	cp lgc/*.lisp ${MIRROR}/lgc
	cp lgc/base.lgs ${MIRROR}/lgc
	cp lgc/lgc.lgs ${MIRROR}/lgc
bmake:	bpages
	env logiweb_httphost=127.0.0.1 ${MAKE}
btest:
	env PATH=${CURDIR}/lgc:${PATH} \
	env LD_LIBRARY_PATH=${CURDIR}/common \
	${MAKE} test
bself:
	${MAKE} -C lgc/build self
bdiff:
	diff -r lgc/build/self ../lgc | more
