moonbridge

view 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 (12 months ago)
parents 253eba579b6a
children
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
13 .elif $(PLATFORM) == "Linux"
14 # Distinguish between different Linux distributions
15 DISTRIBUTION != lsb_release -i -s
16 .if $(DISTRIBUTION) == "Debian" || $(DISTRIBUTION) == "Raspbian"
17 # Default configuration for Debian
18 LUA_INCLUDE ?= /usr/include/lua5.3
19 LUA_LIBDIR ?= /usr/lib
20 LUA_LIBRARY ?= lua5.3
21 UTIL_FLAGS ?= -ldl -lbsd -lrt
22 .elif $(DISTRIBUTION) == "Ubuntu"
23 # Default configuration for Ubuntu
24 LUA_INCLUDE ?= /usr/include/lua5.3
25 LUA_LIBDIR ?= /usr/lib/x86_64-linux-gnu
26 LUA_LIBRARY ?= lua5.3
27 UTIL_FLAGS ?= -ldl -lbsd
28 .else
29 # Default configuration for other Linux distributions
30 LUA_INCLUDE ?= /usr/include
31 LUA_LIBDIR ?= /usr/lib
32 LUA_LIBRARY ?= lua
33 UTIL_FLAGS ?= -ldl -lbsd
34 .endif
36 .else
37 # Default configuration for other systems
38 LUA_INCLUDE ?= /usr/include
39 LUA_LIBDIR ?= /usr/lib
40 LUA_LIBRARY ?= lua
41 UTIL_FLAGS ?= -lutil
43 .endif
45 .ifdef MOONBR_LUA_PATH
46 MOONBR_LUA_PATH_DEFINE = "-DMOONBR_LUA_PATH=\"$(MOONBR_LUA_PATH)\""
47 .endif
49 .ifdef MOONBR_LUA_CPATH
50 MOONBR_LUA_CPATH_DEFINE = "-DMOONBR_LUA_CPATH=\"$(MOONBR_LUA_CPATH)\""
51 .endif
53 all:: moonbridge moonbridge_io.so
55 moonbridge: moonbridge.c moonbridge_io.h moonbridge_io.o
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
58 moonbridge_io.o: moonbridge_io.c moonbridge_io.h
59 cc -c -Wall -O2 -fPIC -I $(LUA_INCLUDE) -o moonbridge_io.o moonbridge_io.c
61 moonbridge_io.so: moonbridge_io.o
62 cc -shared -o moonbridge_io.so moonbridge_io.o $(UTIL_FLAGS)
64 freebsd_with_tls::
65 #TODO
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
68 clean::
69 rm -f moonbridge moonbridge_io.o moonbridge_io.so

Impressum / About Us