-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tuprules.tup
59 lines (49 loc) · 2.11 KB
/
Tuprules.tup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.gitignore
# Include the host configuration
include host.tup
include toolchain.lua
# There's a minor glitch in Tup at the moment where Lua-set variables can't be
# overwritten by Tupfiles. Here we copy the HOST_* and TARG_* Lua variables
# into Tup variables called H_* and *, respectively.
H_CC = $(HOST_CC)
H_CPPFLAGS = $(HOST_CPPFLAGS)
H_CFLAGS = $(HOST_CFLAGS)
H_LDFLAGS = $(HOST_LDFLAGS)
H_LDLIBS = $(HOST_LDLIBS)
H_AR = $(HOST_AR)
CC = $(TARG_CC)
CPPFLAGS = $(TARG_CPPFLAGS)
CFLAGS = $(TARG_CFLAGS)
LDFLAGS = $(TARG_LDFLAGS)
LDLIBS = $(TARG_LDLIBS)
AR = $(TARG_AR)
# References for easy manouvering. Easier than a bunch of ..'s, I hope.
&root = .
&apicore = apis/core
&external = external
&src = src
&inc = include
&incvV = include/vivacious
&lib = lib
# Macros for running the generator system. The spec name comes after the macro.
!gen = | &(external)/lua53 |> ^o Generated %o using %b^ \
&(external)/lua53 -E -e "package.path = '&(root)/?.lua'" \
&(apicore)/generation.lua %f %o |>
# Macros for handling C code come next, the prefixes mean the following:
# e*: For external host code, so does not include any outputs from Vv.
# t*: For target code, and includes outputs from Vv. Good for the real outputs.
# These use the semi-standard GNU make names for the different parts of the
# command lines. For more information, see:
# https://www.gnu.org/software/make/manual/html_node/Catalogue-of-Rules.html
# Macros for compiling C code (.c -> .o)
!ecc = |> ^o Compiled host %b^ $(H_CC) $(H_CPPFLAGS) $(H_CFLAGS) -fPIC -c -o %o %f |>
!tcc = | &(incvV)/*.h |> ^o Compiled %b^ $(CC) $(CPPFLAGS) $(CFLAGS) -I&(inc) -fPIC -c -o %o %f |>
# Macros for linking executables (.o -> .exe)
!eld = |> ^o Linked host %o^ $(H_CC) $(H_LDFLAGS) -o %o %f $(H_LDLIBS) |>
!tld = |> ^o Linked %o^ $(CC) $(LDFLAGS) -o %o %f $(LDLIBS) |>
# Macros for linking libraries (.o -> .so)
!eso = |> ^o Linked host %o^ $(H_CC) $(H_LDFLAGS) -shared -o %o %f $(H_LDLIBS) |>
!tso = |> ^o Linked %o^ $(CC) $(LDFLAGS) -shared -o %o %f $(LDLIBS) |>
# Macros for archiving (.o -> .a)
!ear = |> ^o Archived host %o^ $(H_AR) -rcs %o %f |>
!tar = |> ^o Archived %o^ $(AR) -rcs %o %f |>