moonbridge

view Makefile @ 335:f115f1d5a48c

Added tag v1.1.3 for changeset 62901393deb0
author jbe
date Wed Apr 28 13:03:31 2021 +0200 (2 months ago)
parents 247d9d029306
children
line source
1 # BSD Makefile
2 # On GNU systems, use bmake.
4 .ifndef PLATFORM
5 PLATFORM != uname
6 .endif
8 .if $(PLATFORM) == "FreeBSD"
9 # Default configuration for FreeBSD
10 LUA_INCLUDE ?= /usr/local/include/lua53
11 LUA_LIBDIR ?= /usr/local/lib
12 LUA_LIBRARY ?= lua-5.3
13 UTIL_FLAGS ?= -lutil
15 .elif $(PLATFORM) == "Linux"
16 # Distinguish between different Linux distributions
17 .ifndef DISTRIBUTION
18 DISTRIBUTION != lsb_release -i -s
19 .endif
20 .if $(DISTRIBUTION) == "Debian" || $(DISTRIBUTION) == "Raspbian"
21 # Default configuration for Debian
22 LUA_INCLUDE ?= /usr/include/lua5.3
23 LUA_LIBDIR ?= /usr/lib
24 LUA_LIBRARY ?= lua5.3
25 UTIL_FLAGS ?= -ldl -lbsd -lrt
26 .elif $(DISTRIBUTION) == "Ubuntu"
27 # Default configuration for Ubuntu
28 LUA_INCLUDE ?= /usr/include/lua5.3
29 LUA_LIBDIR ?= /usr/lib/x86_64-linux-gnu
30 LUA_LIBRARY ?= lua5.3
31 UTIL_FLAGS ?= -ldl -lbsd
32 .else
33 # Default configuration for other Linux distributions
34 .warning Could not determine Linux distribution. You might need to set LUA_INCLUDE, LUA_LIBDIR, LUA_LIBRARY, and UTIL_FLAGS manually!
35 LUA_INCLUDE ?= /usr/include
36 LUA_LIBDIR ?= /usr/lib
37 LUA_LIBRARY ?= lua
38 UTIL_FLAGS ?= -ldl -lbsd
39 .endif
41 .else
42 # Default configuration for other systems
43 .warning Could not determine Platform. You might need to set LUA_INCLUDE, LUA_LIBDIR, LUA_LIBRARY, and UTIL_FLAGS manually!
44 LUA_INCLUDE ?= /usr/include
45 LUA_LIBDIR ?= /usr/lib
46 LUA_LIBRARY ?= lua
47 UTIL_FLAGS ?= -lutil
49 .endif
51 .ifdef MOONBR_LUA_PATH
52 MOONBR_LUA_PATH_DEFINE = "-DMOONBR_LUA_PATH=\"$(MOONBR_LUA_PATH)\""
53 .endif
55 .ifdef MOONBR_LUA_CPATH
56 MOONBR_LUA_CPATH_DEFINE = "-DMOONBR_LUA_CPATH=\"$(MOONBR_LUA_CPATH)\""
57 .endif
59 all:: moonbridge moonbridge_io.so
61 moonbridge: moonbridge.c moonbridge_io.h moonbridge_io.o
62 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
64 moonbridge_io.o: moonbridge_io.c moonbridge_io.h
65 cc -c -Wall -O2 -fPIC -I $(LUA_INCLUDE) -o moonbridge_io.o moonbridge_io.c
67 moonbridge_io.so: moonbridge_io.o
68 cc -shared -o moonbridge_io.so moonbridge_io.o $(UTIL_FLAGS)
70 freebsd_with_tls::
71 #TODO
72 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
74 clean::
75 rm -f moonbridge moonbridge_io.o moonbridge_io.so

Impressum / About Us