-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (32 loc) · 1.07 KB
/
Makefile
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
build:
# --------------------------------------------------------------------
# compile lib
# --------------------------------------------------------------------
gcc -c -fPIC libtest.cc -o libtest.o
@echo
# --------------------------------------------------------------------
# static
# --------------------------------------------------------------------
ar rcs libtest.a libtest.o
go build -ldflags="-extldflags=-static" static.go
ldd static || true
@echo
# --------------------------------------------------------------------
# dynamic
# --------------------------------------------------------------------
gcc -shared -Wl,-soname,libtest.so -o libtest.so libtest.o
go build dynamic.go
LD_LIBRARY_PATH=. ldd dynamic
@echo
# --------------------------------------------------------------------
# run both
# --------------------------------------------------------------------
LD_LIBRARY_PATH=. ./dynamic
# --------------------------------------------------------------------
./static
clean:
rm dynamic
rm static
rm libtest.a
rm libtest.o
rm libtest.so