Improve makefile to allow overriden variables

Before this change, it was difficult to set default
directories for different platforms that would still
work with different Lua versions.
This commit is contained in:
Diego Nehab 2012-05-11 15:33:47 +08:00
parent 399bdb7f41
commit 05535a19f8
2 changed files with 21 additions and 11 deletions

View File

@ -23,10 +23,10 @@ test:
lua test/hello.lua lua test/hello.lua
install-both: install-both:
touch src/*.c $(MAKE) clean
@cd src; $(MAKE) $(PLAT) LUAV=5.1 @cd src; $(MAKE) $(PLAT) LUAV=5.1
@cd src; $(MAKE) install-unix LUAV=5.1 @cd src; $(MAKE) install-unix LUAV=5.1
touch src/*.c $(MAKE) clean
@cd src; $(MAKE) $(PLAT) LUAV=5.2 @cd src; $(MAKE) $(PLAT) LUAV=5.2
@cd src; $(MAKE) install-unix LUAV=5.2 @cd src; $(MAKE) install-unix LUAV=5.2

View File

@ -25,26 +25,36 @@ LUAV?=5.1
# for testing and debugging luasocket itself # for testing and debugging luasocket itself
DEBUG?=NODEBUG DEBUG?=NODEBUG
# prefix: /usr/local /usr /opt/local /sw
# the top of the default install tree
prefix?=/usr/local
# where lua headers are found for macosx builds # where lua headers are found for macosx builds
# LUAINC_macosx: /opt/local/include # LUAINC_macosx:
LUAINC_macosx?=/opt/local/include # /opt/local/include
# FIXME default should be where fink puts lua LUAINC_macosx_base?=/opt/local/include
LUAINC_macosx?=$(LUAINC_macosx_base)$(LUAV)
# FIXME default should this default to fink or to macports?
# What happens when more than one Lua version is installed?
LUAPREFIX_macosx?=/opt/local/
# LUAINC_linux: /usr/include/lua$(LUAV) /usr/local/include /usr/local/include/lua$(LUAV) # LUAINC_linux:
# /usr/include/lua$(LUAV)
# /usr/local/include
# /usr/local/include/lua$(LUAV)
# where lua headers are found for linux builds # where lua headers are found for linux builds
LUAINC_linux?=/usr/include/lua$(LUAV) LUAINC_linux_base?=/usr/include
LUAINC_linux?=$(LUAINC_linux_base)$(LUAV)
LUAPREFIX_linux?=/usr/local
# LUAINC_win32: # LUAINC_win32:
# LUALIB_win32: # LUALIB_win32:
# where lua headers and libraries are found for win32 builds # where lua headers and libraries are found for win32 builds
LUAINC_win32?="../../lua-5.1.3/src" LUAINC_win32?="../../lua-5.1.3/src"
LUALIB_win32?="../../lua-5.1.3" LUALIB_win32?="../../lua-5.1.3"
LUAPREFIX_win32?=
# FIXME default should be where lua-for-windows puts lua # FIXME default should be where lua-for-windows puts lua
# prefix: /usr/local /usr /opt/local /sw
# the top of the default install tree
prefix?=$(LUAPREFIX_$(PLAT))
# DESTDIR: (no default) # DESTDIR: (no default)
# used by package managers to install into a temporary destination # used by package managers to install into a temporary destination
DESTDIR= DESTDIR=