# makefile for Lua hierarchy
# see INSTALL for installation instructions
# see file "config" for customization instructions

LUA= .

include $(LUA)/config

# primary targets
all co clean klean:
	cd include; $(MAKE) $@
	cd src; $(MAKE) $@
	cd src/luac; $(MAKE) $@
	cd src/lib; $(MAKE) $@
	cd src/lua; $(MAKE) $@

# remove debug information from binaries
strip:
	strip bin/lua*

# official installation
install: all strip
	mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN)
	$(INSTALL) bin/* $(INSTALL_BIN)
	$(INSTALL) include/*.h $(INSTALL_INC)
	$(INSTALL) lib/lib* $(INSTALL_LIB)
	$(INSTALL) doc/*.man $(INSTALL_MAN)

# shared libraries (for Linux)
so:
	ld -o lib/liblua.so.4.0 -shared src/*.o
	ld -o lib/liblualib.so.4.0 -shared src/lib/*.o
	cd lib; ln -s liblua.so.4.0 liblua.so; ln -s liblualib.so.4.0 liblualib.so

# binaries using shared libraries
sobin:
	rm bin/lua bin/luac
	cd src/lua; make
	cd src/luac; make

# (end of Makefile)
