moonbridge

annotate Makefile @ 324:253eba579b6a

Add -L/usr/lib -lc to all invocations of ld on FreeBSD
author jbe
date Sat Oct 12 20:38:16 2019 +0200 (13 months ago)
parents 1cd58b8efa23
children 73c009c2f389
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@324 12 LD_FLAGS ?= -L/usr/lib -lc
jbe@0 13
jbe@24 14 .elif $(PLATFORM) == "Linux"
jbe@16 15 # Distinguish between different Linux distributions
jbe@24 16 DISTRIBUTION != lsb_release -i -s
jbe@320 17 .if $(DISTRIBUTION) == "Debian" || $(DISTRIBUTION) == "Raspbian"
jbe@25 18 # Default configuration for Debian
jbe@262 19 LUA_INCLUDE ?= /usr/include/lua5.3
jbe@25 20 LUA_LIBDIR ?= /usr/lib
jbe@262 21 LUA_LIBRARY ?= lua5.3
jbe@25 22 UTIL_FLAGS ?= -ldl -lbsd -lrt
jbe@25 23 .elif $(DISTRIBUTION) == "Ubuntu"
jbe@16 24 # Default configuration for Ubuntu
jbe@262 25 LUA_INCLUDE ?= /usr/include/lua5.3
jbe@16 26 LUA_LIBDIR ?= /usr/lib/x86_64-linux-gnu
jbe@262 27 LUA_LIBRARY ?= lua5.3
jbe@16 28 UTIL_FLAGS ?= -ldl -lbsd
jbe@16 29 .else
jbe@16 30 # Default configuration for other Linux distributions
jbe@0 31 LUA_INCLUDE ?= /usr/include
jbe@0 32 LUA_LIBDIR ?= /usr/lib
jbe@0 33 LUA_LIBRARY ?= lua
jbe@0 34 UTIL_FLAGS ?= -ldl -lbsd
jbe@16 35 .endif
jbe@0 36
jbe@0 37 .else
jbe@0 38 # Default configuration for other systems
jbe@0 39 LUA_INCLUDE ?= /usr/include
jbe@0 40 LUA_LIBDIR ?= /usr/lib
jbe@0 41 LUA_LIBRARY ?= lua
jbe@0 42 UTIL_FLAGS ?= -lutil
jbe@0 43
jbe@0 44 .endif
jbe@0 45
jbe@8 46 .ifdef MOONBR_LUA_PATH
jbe@8 47 MOONBR_LUA_PATH_DEFINE = "-DMOONBR_LUA_PATH=\"$(MOONBR_LUA_PATH)\""
jbe@8 48 .endif
jbe@8 49
jbe@9 50 .ifdef MOONBR_LUA_CPATH
jbe@9 51 MOONBR_LUA_CPATH_DEFINE = "-DMOONBR_LUA_CPATH=\"$(MOONBR_LUA_CPATH)\""
jbe@9 52 .endif
jbe@9 53
jbe@185 54 all:: moonbridge moonbridge_io.so
jbe@79 55
jbe@79 56 moonbridge: moonbridge.c moonbridge_io.h moonbridge_io.o
jbe@79 57 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 58
jbe@139 59 moonbridge_io.o: moonbridge_io.c moonbridge_io.h
jbe@79 60 cc -c -Wall -O2 -fPIC -I $(LUA_INCLUDE) -o moonbridge_io.o moonbridge_io.c
jbe@79 61
jbe@79 62 moonbridge_io.so: moonbridge_io.o
jbe@324 63 ld $(LD_FLAGS) -shared -o moonbridge_io.so moonbridge_io.o $(UTIL_FLAGS)
jbe@0 64
jbe@243 65 freebsd_with_tls::
jbe@243 66 #TODO
jbe@324 67 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 && ld $(LD_FLAGS) -L/usr/local/lib -shared -o moonbridge_io.so moonbridge_io.o -lutil -ltls
jbe@243 68
jbe@185 69 clean::
jbe@185 70 rm -f moonbridge moonbridge_io.o moonbridge_io.so
jbe@139 71

Impressum / About Us