[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: autoconf / automake
- From: Francesco Abbate <francesco.bbt@...>
- Date: Fri, 28 Oct 2011 00:10:19 +0200
> Could you please elaborate? I don't recall any major issues reported
Since I've criticized the Lua Makefile now I need to explain :-)
When you build lua you give something like:
so you give the PLATFORM as the target and this is already wrong. You
are not doing "linux", you are building Lua. The platform should be a
variable, not the target.
Then you go inside the "src" directory and you discover something like that:
$(MAKE) all CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX
-DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall"
$(MAKE) all MYCFLAGS=-DLUA_ANSI
$(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E"
$(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline"
$(MAKE) all MYCFLAGS=
$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl
-lreadline -lhistory -lncurses"
Once again, this is wrong because "linux" or "bsd" or "macosx" is not
the target but the real problem is how it works.
It call *again* make with a "make all" by setting MYCFLAGS and MYLIBS.
Once make is called for the second time now it can do the real work.
Why this is wrong ? Well, actually it *works* but it is really
convoluted and it is not the idiomatic way to write a makefile. The
platform should be an option, not the target, so it should be
Because of this "error" you are obliged to call make *twice* in the
directory src, the first time with the wrong target (e.g. linux) and
the second time with the good target (all) but with the good options
So, the makefile is not really wrong but it is convoluted and it does
use the makefile in a non idiomatic way.
For the other side the LuaJIT2 makefile use a very smart way to detect
the OS so you don't even need to specify the platform. The trick is:
ifneq (,$(findstring Windows,$(OS)))
HOST_SYS:= $(shell uname -s)
ifneq (,$(findstring CYGWIN,$(TARGET_SYS)))
So the LuaJIT2's Makefile is more successfull at using Makefile in the
right way :-)
I guess that it does depend on the GNU Makefile but the motto is:
"do not write portable makefiles but use a portable make (GNU make)" :-)