-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tuprules.tup
104 lines (86 loc) · 3.55 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# dependencies referenced by commit, yay
&ccandir=ext/ccan
&lfhtdir=ext/lfht
&muidldir=ext/muidl
&mungdir=ext/mung
# TODO: add "import" to these two when Devuan ceres gets an up-to-date tup.
CC=ccache gcc
LD=ld.gold
&muidl=ext/muidl/muidl
# other paths
&libdir=lib
&idldir=idl
&includedir=include
&userdir=user
&sysdir=sys
&rootdir=root
# things for subordinate Tupfiles to augment as they need
&incdir=include
# (TODO: become independent of the mung includes)
&incdir+=ext/mung/include
&incdir+=ext/muidl/include
&incdir+=ext/lfht
&incdir+=ext/ccan
&idl_incdir=ext/muidl/share/idl
&idl_incdir+=ext/mung/idl
&idl_incdir+=idl
# (note the difference in semantics between &incdir and &libdir.)
&libpath=ext/mung/user/lib/l4
# script-like tools
&foreach=scripts/foreach.pl
ifeq (@(DEBUG),n)
CFLAGS += -O2
DEBUG_FLAGS += -DNDEBUG
else
CFLAGS += -Og -g1
ifeq (@(MORE_DEBUG),y)
DEBUG_FLAGS += -DDEBUG_ME_HARDER
DEBUG_FLAGS += -D_L4_DEBUG_ME_HARDER
DEBUG_FLAGS += -DCCAN_LIST_DEBUG
endif
ifeq (@(JUST_DEBUG_ME_UP),y)
CFLAGS += -Werror
endif
endif
ifeq (@(SELFTEST),y)
BUILD_FLAGS+=-DBUILD_SELFTEST
endif
MUIDLFLAGS=$(DEBUG_FLAGS) $(BUILD_FLAGS)
CFLAGS+=-Wall -mtune=native -march=pentium2 -std=gnu11 -pipe -D_GNU_SOURCE
CFLAGS+=-m32 -mno-avx -mno-sse2 -ffunction-sections
CFLAGS+=-fno-pic -fuse-ld=gold -fno-builtin -nostdlib -ffreestanding
CFLAGS+=-Wno-frame-address
CFLAGS+=$(DEBUG_FLAGS) $(BUILD_FLAGS)
LDFLAGS=-L /usr/lib32 -L /usr/lib/i386-linux-gnu --gc-sections
LIBS=-ll4 -lm `gcc $(CFLAGS) -print-libgcc-file-name`
&USER_LDSCRIPT=user/crt/static.ld
USER_LDFLAGS=-e_start -nostdlib
USER_LIBS=-lsneks-user-crt -lsneks
&SYS_LDSCRIPT=sys/crt/systask.ld
SYS_LDFLAGS=-e_start -nostdlib
SYS_LIBS=-lsneks-systask -lsneks-sysidl -lsneks
!cc = | &(libdir)/<apidefs> &(libdir)/<sysdefs> |> ^o CC %o^ $(CC) `&(foreach) '-I+' &(incdir)` $(CFLAGS) $(CFLAGS_%b) -c %f -o %o |>
!as = |> ^o AS %o^ $(CC) -DIN_ASM_SOURCE `&(foreach) '-I+' &(incdir)` $(CFLAGS) -c %f -o %o |>
!ar = |> ^o AR %o^ ar scr %o %f |>
!user-ld = | &(USER_LDSCRIPT) &(libdir)/libsneks.a &(userdir)/crt/*.a \
|> ^o LD %o^ $(LD) $(LDFLAGS) $(USER_LDFLAGS) -L &(userdir)/crt `&(foreach) '-L+' &(libpath)` -static -o %o -T &(USER_LDSCRIPT) %f -\( $(USER_LIBS) $(LIBS) -\) |>
!sys-ld = | &(SYS_LDSCRIPT) &(libdir)/libsneks.a &(sysdir)/crt/*.a \
|> ^o LD %o^ $(LD) $(LDFLAGS) $(SYS_LDFLAGS) -L &(sysdir)/crt `&(foreach) '-L+' &(libpath)` -static -o %o -T &(SYS_LDSCRIPT) %f -\( $(SYS_LIBS) $(LIBS) -\) |>
# add ^t to these when Devuan's tup gets one
!idlclient = |> ^ IDL %b <client>^ &(muidl) `&(foreach) '-I +' &(idl_incdir)` $(MUIDLFLAGS) --client --common --defs %f |> %B-client.s %B-common.s %B-defs.h
!idlimpl = |> ^ IDL %b <impl>^ &(muidl) `&(foreach) '-I +' &(idl_incdir)` $(MUIDLFLAGS) --service --common --defs %f |> %B-service.s %B-common.s %B-defs.h
# generate a squashfs image such that fs.squashfs will consume it.
!mksquashfs = |> ^ MKSQUASHFS %o^ mksquashfs %f %o -comp lz4 -Xhc -all-root -no-fragments >/dev/null 2>/dev/null |> %o
# putting things on the initrd. systasks under &(initrd)/$(mods), userspace in
# plain &(initrd). add every !install or !install644 product to user/<initrd>
# or sys/<initrd>. for absolute symlinks, prefix with $(target_initrd).
&initrd = .initrd-staging
mods = lib/sneks-0.0p0
target_initrd = /initrd
!install = |> ^ INSTALL %o^ install -D %f %o |>
# i.e. u=rw,og=r
!install644 = |> ^ INSTALL-644 %o^ install --mode=644 -D %f %o |>
# install and strip
!installs = |> ^ INSTALL-s %o^ install -s -D %f %o |>
# tags for convenience. vim users would set tags=**/tags .
: *.c *.h *.pl *.pm |> ^ TAGS^ ctags %f |> tags