-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun
More file actions
executable file
·51 lines (47 loc) · 1.19 KB
/
run
File metadata and controls
executable file
·51 lines (47 loc) · 1.19 KB
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
#!/bin/sh
# only tested in arch linux.
compiler='gcc -std=gnu11 -pedantic -Wall -Wextra -Wshadow -Wwrite-strings'
main_compiler="$compiler -l readline -l m -o sclisp utils.c sclisp.c lib/mpc.a"
# Reference:
# https://dev.to/iamkhalil42/all-you-need-to-know-about-c-static-libraries-1o0b
mpc_compiler="$compiler -fpic -c mpc.c"
mpc_static='ar -r lib/mpc.a mpc.o'
case "$1" in
main)
$main_compiler
;;
main-debug)
$main_compiler -ggdb3 -D DEBUG
;;
mpc)
# To list the names of object files,
# we can use `ar -t mpc.a`.
$mpc_compiler
$mpc_static
;;
playground)
gcc -l readline -o playground playground.c
;;
playground-debug)
gcc -save-temps -l readline -o playground playground.c
;;
playground-objdump)
gcc -l readline -ggdb -c playground.c
objdump --source --full-contents --reloc playground.o
;;
playground-readelf-segments)
gcc -l readline -ggdb -o playground playground.c
readelf --segments playground
;;
*)
printf "%s\n\n%s\n" "Usage: $0 SUBCOMMANDS" "SUBCOMMANDS:
- main
- main-debug
- mpc
- playground
- playground-debug
- playground-objdump
- playground-readelf-segments
"
;;
esac