forked from liztio/cgo-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
32 lines (24 loc) · 747 Bytes
/
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
.PHONY: all clean run
GO?="go"
addlib := $(shell pwd)/src/addlib
all:
@make -C src/addlib
@make -C src/addbin
@make -C src/gofromc
@make addbin
@make imagemagick
@make cfromgo
clean:
rm -f addbin c_from_go imagemagick
@make -C src/addlib clean
@make -C src/gofromc clean
@make -C src/addbin clean
src/addlib/addlib.a: src/addlib/addlib.c
$(CC)
go_bin: addbin
addbin: cmd/addbin/main.go src/addlib/addlib.o
CGO_CFLAGS=-I$(addlib) CGO_LDFLAGS=-L$(addlib) $(GO) build github.com/liztio/cgo-demo/cmd/addbin
imagemagick: cmd/imagemagick/main.go
$(GO) build github.com/liztio/cgo-demo/cmd/imagemagick
cfromgo: cmd/c_from_go/addlib.c cmd/c_from_go/addlib.h cmd/c_from_go/main.go
$(GO) build github.com/liztio/cgo-demo/cmd/c_from_go