-
Notifications
You must be signed in to change notification settings - Fork 79
/
Makefile.win
69 lines (56 loc) · 1.66 KB
/
Makefile.win
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
# TODO FIXME find a better way to detect the directory to use
# for OpenCL development files
!IF "$(OPENCLDIR)" == ""
OPENCLDIR = $(INTELOCLSDKROOT)
!ENDIF
!IF "$(OPENCLDIR)" == ""
OPENCLDIR = $(AMDAPPSDKROOT)
!ENDIF
!IF "$(OPENCLDIR)" == ""
OPENCLDIR = $(MAKEDIR)
!ENDIF
!IF "$(OPENCLDIR)" == ""
OPENCLDIR = .
!ENDIF
!MESSAGE OpenCL dir: $(OPENCLDIR)
HDR = src/error.h \
src/ext.h \
src/ctx_prop.h \
src/fmtmacros.h \
src/memory.h \
src/ms_support.h \
src/info_loc.h \
src/info_ret.h \
src/opt_out.h \
src/strbuf.h
CFLAGS = /GL /Ox /W4 /Zi /I"$(OPENCLDIR)\include" /nologo
LIBS = libOpenCL.a
# TODO there's most likely a better way to do the multiarch
# switching
!IF "$(PROCESSOR_ARCHITECTURE)" == "AMD64"
ARCH=64
!ELSE
ARCH=32
!ENDIF
# Platform=x64 in the 64-bit cross-platform build of my VS
!IF "$(PLATFORM)" == "x64" || "$(PLATFORM)" == "X64"
ARCH=64
!ELSE IF "$(PLATFORM)" == "x86" || "$(PLATFORM)" == "X86"
ARCH=32
!ENDIF
!MESSAGE Building for $(ARCH)-bit (processor architecture: $(PROCESSOR_ARCHITECTURE), platform: $(PLATFORM))
LIBPATH32 = /LIBPATH:"$(OPENCLDIR)\lib" /LIBPATH:"$(OPENCLDIR)\lib\x86"
LIBPATH64 = /LIBPATH:"$(OPENCLDIR)\lib\x64" /LIBPATH:"$(OPENCLDIR)\lib\x86_64" /LIBPATH:"$(OPENCLDIR)\lib\x86_amd64"
# And since we can't do $(LIBPATH$(ARCH)) with nmake ...
!IF "$(ARCH)" == "64"
LINKOPTS = /LTCG $(LIBPATH64) /nologo
!ELSE
LINKOPTS = /LTCG $(LIBPATH32) /nologo
!ENDIF
clinfo.exe: clinfo.obj
link $(LINKOPTS) $(LIBS) clinfo.obj /out:clinfo.exe
clinfo.obj: src/clinfo.c $(HDR)
$(CC) $(CFLAGS) /c src/clinfo.c /Foclinfo.obj
clean:
del /F /Q clinfo.exe clinfo.obj
.PHONY: clean