-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (50 loc) · 938 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
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
name = img
dllName = $(name).dll
all: $(dllName)
sources = main.go
objsDll =
libsDll = ./$(name).a -l msvcrt -l ws2_32 -l winmm
defFile = $(name).def
# Debug flag: yes, no
debug = no
ifeq ("$(debug)", "yes")
flags = -gcflags "-N -l"
else
flags = -ldflags "-s -w"
endif
ifndef x64
ifeq ("$(Platform)", "")
x64 = 0
else
ifeq ($(Platform), x64)
x64 = 1
else
x64 = 0
endif
endif
endif
ifeq ($(x64), 1)
machine := X64
else
machine := X86
endif
$(defFile):
@echo "LIBRARY $(dllName)" >$@
@echo "EXPORTS" >>$@
@echo " ImageEncode @1" >> $@
$(name).a: $(sources)
go build $(flags) -buildmode=c-archive
$(dllName): $(objsDll) $(name).a $(defFile)
dllwrap -o $@ --no-export-all-symbols --def $(defFile) $(objsDll) $(libsDll)
lib -out:$(name).lib -def:$(defFile) -machine:$(machine) -nologo
strip $@
clean:
rm -f *.a
rm -f *.lib
rm -f *.def
rm -f *.exp
rm -f $(name).h
rm -f *.exe
cleanall: clean
go clean
rm -f *.dll