From 05535a19f81d181b7e15d241892e794a00905bb9 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Fri, 11 May 2012 15:33:47 +0800 Subject: [PATCH] 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. --- makefile | 4 ++-- src/makefile | 28 +++++++++++++++++++--------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/makefile b/makefile index 934485b..f9fa6fe 100644 --- a/makefile +++ b/makefile @@ -23,10 +23,10 @@ test: lua test/hello.lua install-both: - touch src/*.c + $(MAKE) clean @cd src; $(MAKE) $(PLAT) 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) install-unix LUAV=5.2 diff --git a/src/makefile b/src/makefile index 4df62bd..70425c4 100644 --- a/src/makefile +++ b/src/makefile @@ -25,26 +25,36 @@ LUAV?=5.1 # for testing and debugging luasocket itself 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 -# LUAINC_macosx: /opt/local/include -LUAINC_macosx?=/opt/local/include -# FIXME default should be where fink puts lua +# LUAINC_macosx: +# /opt/local/include +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 -LUAINC_linux?=/usr/include/lua$(LUAV) +LUAINC_linux_base?=/usr/include +LUAINC_linux?=$(LUAINC_linux_base)$(LUAV) +LUAPREFIX_linux?=/usr/local # LUAINC_win32: # LUALIB_win32: # where lua headers and libraries are found for win32 builds LUAINC_win32?="../../lua-5.1.3/src" LUALIB_win32?="../../lua-5.1.3" +LUAPREFIX_win32?= # 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) # used by package managers to install into a temporary destination DESTDIR=