moonbridge

view 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 (11 months ago)
parents 1cd58b8efa23
children 73c009c2f389
line source
1 # BSD Makefile
2 # On GNU systems, use bmake.
4 PLATFORM != uname
6 .if $(PLATFORM) == "FreeBSD"
7 # Default configuration for FreeBSD
8 LUA_INCLUDE ?= /usr/local/include/lua53
9 LUA_LIBDIR ?= /usr/local/lib
10 LUA_LIBRARY ?= lua-5.3
11 UTIL_FLAGS ?= -lutil
12 LD_FLAGS ?= -L/usr/lib -lc
14 .elif $(PLATFORM) == "Linux"
15 # Distinguish between different Linux distributions
16 DISTRIBUTION != lsb_release -i -s
17 .if $(DISTRIBUTION) == "Debian" || $(DISTRIBUTION) == "Raspbian"
18 # Default configuration for Debian
19 LUA_INCLUDE ?= /usr/include/lua5.3
20 LUA_LIBDIR ?= /usr/lib
21 LUA_LIBRARY ?= lua5.3
22 UTIL_FLAGS ?= -ldl -lbsd -lrt
23 .elif $(DISTRIBUTION) == "Ubuntu"
24 # Default configuration for Ubuntu
25 LUA_INCLUDE ?= /usr/include/lua5.3
26 LUA_LIBDIR ?= /usr/lib/x86_64-linux-gnu
27 LUA_LIBRARY ?= lua5.3
28 UTIL_FLAGS ?= -ldl -lbsd
29 .else
30 # Default configuration for other Linux distributions
31 LUA_INCLUDE ?= /usr/include
32 LUA_LIBDIR ?= /usr/lib
33 LUA_LIBRARY ?= lua
34 UTIL_FLAGS ?= -ldl -lbsd
35 .endif
37 .else
38 # Default configuration for other systems
39 LUA_INCLUDE ?= /usr/include
40 LUA_LIBDIR ?= /usr/lib
41 LUA_LIBRARY ?= lua
42 UTIL_FLAGS ?= -lutil
44 .endif
46 .ifdef MOONBR_LUA_PATH
47 MOONBR_LUA_PATH_DEFINE = "-DMOONBR_LUA_PATH=\"$(MOONBR_LUA_PATH)\""
48 .endif
50 .ifdef MOONBR_LUA_CPATH
51 MOONBR_LUA_CPATH_DEFINE = "-DMOONBR_LUA_CPATH=\"$(MOONBR_LUA_CPATH)\""
52 .endif
54 all:: moonbridge moonbridge_io.so
56 moonbridge: moonbridge.c moonbridge_io.h moonbridge_io.o
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
59 moonbridge_io.o: moonbridge_io.c moonbridge_io.h
60 cc -c -Wall -O2 -fPIC -I $(LUA_INCLUDE) -o moonbridge_io.o moonbridge_io.c
62 moonbridge_io.so: moonbridge_io.o
63 ld $(LD_FLAGS) -shared -o moonbridge_io.so moonbridge_io.o $(UTIL_FLAGS)
65 freebsd_with_tls::
66 #TODO
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
69 clean::
70 rm -f moonbridge moonbridge_io.o moonbridge_io.so

Impressum / About Us