1*572c4311Sfengbojiang# makefile for installing Lua 2*572c4311Sfengbojiang# see INSTALL for installation instructions 3*572c4311Sfengbojiang# see src/Makefile and src/luaconf.h for further customization 4*572c4311Sfengbojiang 5*572c4311Sfengbojiang# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= 6*572c4311Sfengbojiang 7*572c4311Sfengbojiang# Your platform. See PLATS for possible values. 8*572c4311SfengbojiangPLAT= none 9*572c4311Sfengbojiang 10*572c4311Sfengbojiang# Where to install. The installation starts in the src and doc directories, 11*572c4311Sfengbojiang# so take care if INSTALL_TOP is not an absolute path. 12*572c4311SfengbojiangINSTALL_TOP= /usr/local 13*572c4311SfengbojiangINSTALL_BIN= $(INSTALL_TOP)/bin 14*572c4311SfengbojiangINSTALL_INC= $(INSTALL_TOP)/include 15*572c4311SfengbojiangINSTALL_LIB= $(INSTALL_TOP)/lib 16*572c4311SfengbojiangINSTALL_MAN= $(INSTALL_TOP)/man/man1 17*572c4311Sfengbojiang# 18*572c4311Sfengbojiang# You probably want to make INSTALL_LMOD and INSTALL_CMOD consistent with 19*572c4311Sfengbojiang# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h (and also with etc/lua.pc). 20*572c4311SfengbojiangINSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V 21*572c4311SfengbojiangINSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V 22*572c4311Sfengbojiang 23*572c4311Sfengbojiang# How to install. If your install program does not support "-p", then you 24*572c4311Sfengbojiang# may have to run ranlib on the installed liblua.a (do "make ranlib"). 25*572c4311SfengbojiangINSTALL= install -p 26*572c4311SfengbojiangINSTALL_EXEC= $(INSTALL) -m 0755 27*572c4311SfengbojiangINSTALL_DATA= $(INSTALL) -m 0644 28*572c4311Sfengbojiang# 29*572c4311Sfengbojiang# If you don't have install you can use cp instead. 30*572c4311Sfengbojiang# INSTALL= cp -p 31*572c4311Sfengbojiang# INSTALL_EXEC= $(INSTALL) 32*572c4311Sfengbojiang# INSTALL_DATA= $(INSTALL) 33*572c4311Sfengbojiang 34*572c4311Sfengbojiang# Utilities. 35*572c4311SfengbojiangMKDIR= mkdir -p 36*572c4311SfengbojiangRANLIB= ranlib 37*572c4311Sfengbojiang 38*572c4311Sfengbojiang# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= 39*572c4311Sfengbojiang 40*572c4311Sfengbojiang# Convenience platforms targets. 41*572c4311SfengbojiangPLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris 42*572c4311Sfengbojiang 43*572c4311Sfengbojiang# What to install. 44*572c4311SfengbojiangTO_BIN= lua luac 45*572c4311SfengbojiangTO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp 46*572c4311SfengbojiangTO_LIB= liblua.a 47*572c4311SfengbojiangTO_MAN= lua.1 luac.1 48*572c4311Sfengbojiang 49*572c4311Sfengbojiang# Lua version and release. 50*572c4311SfengbojiangV= 5.1 51*572c4311SfengbojiangR= 5.1.5 52*572c4311Sfengbojiang 53*572c4311Sfengbojiangall: $(PLAT) 54*572c4311Sfengbojiang 55*572c4311Sfengbojiang$(PLATS) clean: 56*572c4311Sfengbojiang cd src && $(MAKE) $@ 57*572c4311Sfengbojiang 58*572c4311Sfengbojiangtest: dummy 59*572c4311Sfengbojiang src/lua test/hello.lua 60*572c4311Sfengbojiang 61*572c4311Sfengbojianginstall: dummy 62*572c4311Sfengbojiang cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) 63*572c4311Sfengbojiang cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) 64*572c4311Sfengbojiang cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) 65*572c4311Sfengbojiang cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) 66*572c4311Sfengbojiang cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) 67*572c4311Sfengbojiang 68*572c4311Sfengbojiangranlib: 69*572c4311Sfengbojiang cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB) 70*572c4311Sfengbojiang 71*572c4311Sfengbojianglocal: 72*572c4311Sfengbojiang $(MAKE) install INSTALL_TOP=.. 73*572c4311Sfengbojiang 74*572c4311Sfengbojiangnone: 75*572c4311Sfengbojiang @echo "Please do" 76*572c4311Sfengbojiang @echo " make PLATFORM" 77*572c4311Sfengbojiang @echo "where PLATFORM is one of these:" 78*572c4311Sfengbojiang @echo " $(PLATS)" 79*572c4311Sfengbojiang @echo "See INSTALL for complete instructions." 80*572c4311Sfengbojiang 81*572c4311Sfengbojiang# make may get confused with test/ and INSTALL in a case-insensitive OS 82*572c4311Sfengbojiangdummy: 83*572c4311Sfengbojiang 84*572c4311Sfengbojiang# echo config parameters 85*572c4311Sfengbojiangecho: 86*572c4311Sfengbojiang @echo "" 87*572c4311Sfengbojiang @echo "These are the parameters currently set in src/Makefile to build Lua $R:" 88*572c4311Sfengbojiang @echo "" 89*572c4311Sfengbojiang @cd src && $(MAKE) -s echo 90*572c4311Sfengbojiang @echo "" 91*572c4311Sfengbojiang @echo "These are the parameters currently set in Makefile to install Lua $R:" 92*572c4311Sfengbojiang @echo "" 93*572c4311Sfengbojiang @echo "PLAT = $(PLAT)" 94*572c4311Sfengbojiang @echo "INSTALL_TOP = $(INSTALL_TOP)" 95*572c4311Sfengbojiang @echo "INSTALL_BIN = $(INSTALL_BIN)" 96*572c4311Sfengbojiang @echo "INSTALL_INC = $(INSTALL_INC)" 97*572c4311Sfengbojiang @echo "INSTALL_LIB = $(INSTALL_LIB)" 98*572c4311Sfengbojiang @echo "INSTALL_MAN = $(INSTALL_MAN)" 99*572c4311Sfengbojiang @echo "INSTALL_LMOD = $(INSTALL_LMOD)" 100*572c4311Sfengbojiang @echo "INSTALL_CMOD = $(INSTALL_CMOD)" 101*572c4311Sfengbojiang @echo "INSTALL_EXEC = $(INSTALL_EXEC)" 102*572c4311Sfengbojiang @echo "INSTALL_DATA = $(INSTALL_DATA)" 103*572c4311Sfengbojiang @echo "" 104*572c4311Sfengbojiang @echo "See also src/luaconf.h ." 105*572c4311Sfengbojiang @echo "" 106*572c4311Sfengbojiang 107*572c4311Sfengbojiang# echo private config parameters 108*572c4311Sfengbojiangpecho: 109*572c4311Sfengbojiang @echo "V = $(V)" 110*572c4311Sfengbojiang @echo "R = $(R)" 111*572c4311Sfengbojiang @echo "TO_BIN = $(TO_BIN)" 112*572c4311Sfengbojiang @echo "TO_INC = $(TO_INC)" 113*572c4311Sfengbojiang @echo "TO_LIB = $(TO_LIB)" 114*572c4311Sfengbojiang @echo "TO_MAN = $(TO_MAN)" 115*572c4311Sfengbojiang 116*572c4311Sfengbojiang# echo config parameters as Lua code 117*572c4311Sfengbojiang# uncomment the last sed expression if you want nil instead of empty strings 118*572c4311Sfengbojianglecho: 119*572c4311Sfengbojiang @echo "-- installation parameters for Lua $R" 120*572c4311Sfengbojiang @echo "VERSION = '$V'" 121*572c4311Sfengbojiang @echo "RELEASE = '$R'" 122*572c4311Sfengbojiang @$(MAKE) echo | grep = | sed -e 's/= /= "/' -e 's/$$/"/' #-e 's/""/nil/' 123*572c4311Sfengbojiang @echo "-- EOF" 124*572c4311Sfengbojiang 125*572c4311Sfengbojiang# list targets that do not create files (but not all makes understand .PHONY) 126*572c4311Sfengbojiang.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho 127*572c4311Sfengbojiang 128*572c4311Sfengbojiang# (end of Makefile) 129