moonbridge

annotate Makefile @ 325:73c009c2f389

Use "cc -shared" instead of "ld -shared" to create *.so files
author jbe
date Sat Oct 19 14:56:47 2019 +0200 (13 months ago)
parents 253eba579b6a
children
rev   line source
jbe@0 1 # BSD Makefile
jbe@0 2 # On GNU systems, use bmake.
jbe@0 3
jbe@24 4 PLATFORM != uname
jbe@24 5
jbe@24 6 .if $(PLATFORM) == "FreeBSD"
jbe@0 7 # Default configuration for FreeBSD
jbe@262 8 LUA_INCLUDE ?= /usr/local/include/lua53
jbe@0 9 LUA_LIBDIR ?= /usr/local/lib
jbe@262 10 LUA_LIBRARY ?= lua-5.3
jbe@324 11 UTIL_FLAGS ?= -lutil
jbe@0 12
jbe@24 13 .elif $(PLATFORM) == "Linux"
jbe@16 14 # Distinguish between different Linux distributions
jbe@24 15 DISTRIBUTION != lsb_release -i -s
jbe@320 16 .if $(DISTRIBUTION) == "Debian" || $(DISTRIBUTION) == "Raspbian"
jbe@25 17 # Default configuration for Debian
jbe@262 18 LUA_INCLUDE ?= /usr/include/lua5.3
jbe@25 19 LUA_LIBDIR ?= /usr/lib
jbe@262 20 LUA_LIBRARY ?= lua5.3
jbe@25 21 UTIL_FLAGS ?= -ldl -lbsd -lrt
jbe@25 22 .elif $(DISTRIBUTION) == "Ubuntu"
jbe@16 23 # Default configuration for Ubuntu
jbe@262 24 LUA_INCLUDE ?= /usr/include/lua5.3
jbe@16 25 LUA_LIBDIR ?= /usr/lib/x86_64-linux-gnu
jbe@262 26 LUA_LIBRARY ?= lua5.3
jbe@16 27 UTIL_FLAGS ?= -ldl -lbsd
jbe@16 28 .else
jbe@16 29 # Default configuration for other Linux distributions
jbe@0 30 LUA_INCLUDE ?= /usr/include
jbe@0 31 LUA_LIBDIR ?= /usr/lib
jbe@0 32 LUA_LIBRARY ?= lua
jbe@0 33 UTIL_FLAGS ?= -ldl -lbsd
jbe@16 34 .endif
jbe@0 35
jbe@0 36 .else
jbe@0 37 # Default configuration for other systems
jbe@0 38 LUA_INCLUDE ?= /usr/include
jbe@0 39 LUA_LIBDIR ?= /usr/lib
jbe@0 40 LUA_LIBRARY ?= lua
jbe@0 41 UTIL_FLAGS ?= -lutil
jbe@0 42
jbe@0 43 .endif
jbe@0 44
jbe@8 45 .ifdef MOONBR_LUA_PATH
jbe@8 46 MOONBR_LUA_PATH_DEFINE = "-DMOONBR_LUA_PATH=\"$(MOONBR_LUA_PATH)\""
jbe@8 47 .endif
jbe@8 48
jbe@9 49 .ifdef MOONBR_LUA_CPATH
jbe@9 50 MOONBR_LUA_CPATH_DEFINE = "-DMOONBR_LUA_CPATH=\"$(MOONBR_LUA_CPATH)\""
jbe@9 51 .endif
jbe@9 52
jbe@185 53 all:: moonbridge moonbridge_io.so
jbe@79 54
jbe@79 55 moonbridge: moonbridge.c moonbridge_io.h moonbridge_io.o
jbe@79 56 cc -Wall -Wno-unused-result -O2 -Wl,-E -I $(LUA_INCLUDE) -L $(LUA_LIBDIR) -o moonbridge $(MOONBR_LUA_PATH_DEFINE) $(MOONBR_LUA_CPATH_DEFINE) moonbridge.c -lm -l$(LUA_LIBRARY) $(UTIL_FLAGS) moonbridge_io.o
jbe@0 57
jbe@139 58 moonbridge_io.o: moonbridge_io.c moonbridge_io.h
jbe@79 59 cc -c -Wall -O2 -fPIC -I $(LUA_INCLUDE) -o moonbridge_io.o moonbridge_io.c
jbe@79 60
jbe@79 61 moonbridge_io.so: moonbridge_io.o
jbe@325 62 cc -shared -o moonbridge_io.so moonbridge_io.o $(UTIL_FLAGS)
jbe@0 63
jbe@243 64 freebsd_with_tls::
jbe@243 65 #TODO
jbe@325 66 cc -D MOONBR_IO_USE_TLS -c -Wall -O2 -fPIC -I /usr/local/include/lua53 -I /usr/local/include -o moonbridge_io.o moonbridge_io.c && cc -L/usr/local/lib -shared -o moonbridge_io.so moonbridge_io.o -lutil -ltls
jbe@243 67
jbe@185 68 clean::
jbe@185 69 rm -f moonbridge moonbridge_io.o moonbridge_io.so
jbe@139 70

Impressum / About Us