Merge pull request #3 from msva/master

DESTDIR compatibility + *FLAGs/utils configurability + ld -fpic error fix + #1 fix
This commit is contained in:
Matthew Wild 2013-05-15 04:02:47 -07:00
commit f77fb40033
3 changed files with 28 additions and 21 deletions

View File

@ -1,6 +1,6 @@
# Inform the location to intall the modules
LUAPATH=/usr/local/share/lua/5.1
LUACPATH=/usr/local/lib/lua/5.1
LUAPATH ?= /usr/share/lua/5.1
LUACPATH ?= /usr/lib/lua/5.1
# Compile with build-in LuaSocket's help files.
# Comment this lines if you will link with non-internal LuaSocket's help files
@ -10,8 +10,10 @@ DEFS=-DWITH_LUASOCKET
# Edit the lines below to inform new path, if necessary.
# Path below points to internal LuaSocket's help files.
INCDIR=-I.
LIBDIR=-L./luasocket
INC_PATH ?= -I/usr/include
LIB_PATH ?= -L/usr/lib
INCDIR = -I. $(INC_PATH)
LIBDIR = -L./luasocket $(LIB_PATH)
# For Mac OS X: set the system version
MACOSX_VERSION=10.4

View File

@ -10,29 +10,32 @@ LIBS=-lssl -lcrypto -lluasocket
WARN=-Wall -pedantic
BSD_CFLAGS=-O2 -fpic $(WARN) $(INCDIR) $(DEFS)
BSD_LDFLAGS=-O -shared -fpic $(LIBDIR)
BSD_CFLAGS=-O2 -fPIC $(WARN) $(INCDIR) $(DEFS)
BSD_LDFLAGS=-O -fPIC -shared $(LIBDIR)
LNX_CFLAGS=-O2 -fpic $(WARN) $(INCDIR) $(DEFS)
LNX_LDFLAGS=-O -shared -fpic $(LIBDIR)
LNX_CFLAGS=-O2 -fPIC $(WARN) $(INCDIR) $(DEFS)
LNX_LDFLAGS=-O -fPIC -shared $(LIBDIR)
MAC_ENV=env MACOSX_DEPLOYMENT_TARGET='$(MACVER)'
MAC_CFLAGS=-O2 -fno-common $(WARN) $(INCDIR) $(DEFS)
MAC_LDFLAGS=-bundle -undefined dynamic_lookup $(LIBDIR)
CC=gcc
LD=$(MYENV) gcc
CFLAGS=$(MYCFLAGS)
LDFLAGS=$(MYLDFLAGS)
INSTALL ?= install
CC ?= cc
LD ?= $(MYENV) cc
CFLAGS += $(MYCFLAGS)
LDFLAGS += $(MYLDFLAGS)
DESTDIR ?= /
.PHONY: all clean install none linux bsd macosx luasocket
all:
install: $(CMOD) $(LMOD)
install -m644 -D $(CMOD) $(LUACPATH)
install -m644 -D $(LMOD) $(LUAPATH)
install -m644 -D https.lua $(LUAPATH)/ssl
$(INSTALL) -d $(DESTDIR)$(LUAPATH)/ssl $(DESTDIR)$(LUACPATH)
$(INSTALL) -D $(CMOD) $(DESTDIR)$(LUACPATH)
$(INSTALL) -m644 -D $(LMOD) $(DESTDIR)$(LUAPATH)
$(INSTALL) -m644 -D https.lua $(DESTDIR)$(LUAPATH)/ssl
linux:
@$(MAKE) $(CMOD) MYCFLAGS="$(LNX_CFLAGS)" MYLDFLAGS="$(LNX_LDFLAGS)" EXTRA="$(EXTRA)"

View File

@ -4,16 +4,18 @@ OBJS= \
timeout.o \
usocket.o
CC=gcc
CFLAGS=$(MYCFLAGS) -DLUASOCKET_DEBUG
CC ?= cc
CFLAGS += $(MYCFLAGS) -DLUASOCKET_DEBUG
AR := ar rcu
RANLIB ?= ranlib
.PHONY: all clean
all: libluasocket.a
libluasocket.a: $(OBJS)
ar rcu $@ $(OBJS)
ranlib $@
$(AR) $@ $(OBJS)
$(RANLIB) $@
clean:
rm -f $(OBJS) libluasocket.a