Add support for FreeBSD in makefile

Thanks to Leryan. See issue #78.
This commit is contained in:
Diego Nehab 2013-09-09 14:29:14 -03:00
parent 396e9e5ee6
commit d0b1f5b4c1
2 changed files with 30 additions and 1 deletions

View File

@ -10,7 +10,7 @@
# print print the build settings # print print the build settings
PLAT?= linux PLAT?= linux
PLATS= macosx linux win32 mingw PLATS= macosx linux win32 mingw freebsd
all: $(PLAT) all: $(PLAT)

View File

@ -52,6 +52,15 @@ LUAPREFIX_linux?=/usr/local
CDIR_linux?=lib/lua/$(LUAV) CDIR_linux?=lib/lua/$(LUAV)
LDIR_linux?=share/lua/$(LUAV) LDIR_linux?=share/lua/$(LUAV)
# LUAINC_freebsd:
# /usr/local/include/lua$(LUAV)
# where lua headers are found for linux builds
LUAINC_freebsd_base?=/usr/local/include/
LUAINC_freebsd?=$(LUAINC_freebsd_base)/lua$(LUAV)
LUAPREFIX_freebsd?=/usr/local/
CDIR_freebsd?=lib/lua/$(LUAV)
LDIR_freebsd?=share/lua/$(LUAV)
# where lua headers are found for mingw builds # where lua headers are found for mingw builds
# LUAINC_mingw: # LUAINC_mingw:
# /opt/local/include # /opt/local/include
@ -155,6 +164,22 @@ LDFLAGS_linux=-O -shared -fpic -o
LD_linux=gcc LD_linux=gcc
SOCKET_linux=usocket.o SOCKET_linux=usocket.o
#------
# Compiler and linker settings
# for FreeBSD
SO_freebsd=so
O_freebsd=o
CC_freebsd=gcc
DEF_freebsd=-DLUASOCKET_$(DEBUG) -DLUA_$(COMPAT)_MODULE \
-DLUASOCKET_API='__attribute__((visibility("default")))' \
-DUNIX_API='__attribute__((visibility("default")))' \
-DMIME_API='__attribute__((visibility("default")))'
CFLAGS_freebsd= -I$(LUAINC) $(DEF) -pedantic -Wall -Wshadow -Wextra \
-Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
LDFLAGS_freebsd=-O -shared -fpic -o
LD_freebsd=gcc
SOCKET_freebsd=usocket.o
#------ #------
# Compiler and linker settings # Compiler and linker settings
# for MingW # for MingW
@ -289,6 +314,10 @@ TO_TOP_LDIR= \
# #
default: $(PLAT) default: $(PLAT)
freebsd:
$(MAKE) all-unix PLAT=freebsd
macosx: macosx:
$(MAKE) all-unix PLAT=macosx $(MAKE) all-unix PLAT=macosx