forked from Oblomov/clinfo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (48 loc) · 1.13 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
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
70
71
72
73
# Headers
PROG = clinfo
MAN = man1/$(PROG).1
HDR = src/error.h \
src/ext.h \
src/fmtmacros.h \
src/memory.h \
src/ms_support.h \
src/strbuf.h
VPATH = src
CFLAGS += -std=c99 -g -Wall -Wextra -pedantic
SPARSE ?= sparse
SPARSEFLAGS=-Wsparse-all -Wno-decl
# BSD make does not define RM
RM ?= rm -f
# Installation paths and modes
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
BINMODE ?= 555
MANDIR ?= $(PREFIX)/man
MANMODE ?= 444
# Common library includes
LDLIBS = -lOpenCL -ldl
# OS-specific library includes
LDLIBS_Darwin = -framework OpenCL
LDLIBS_Darwin_exclude = -lOpenCL
LDLIBS += $(LDLIBS_${OS})
# Remove -lOpenCL if OS is Darwin
LDLIBS := $(LDLIBS:$(LDLIBS_${OS}_exclude)=)
#
# Standard targets
#
$(PROG): $(PROG).o
$(PROG).o: $(PROG).c $(HDR)
clean:
$(RM) $(PROG).o $(PROG)
$(BINDIR):
install -d $@
$(MANDIR)/man1:
install -d $@
$(BINDIR)/$(PROG): $(PROG) $(BINDIR)
install -p -m $(BINMODE) $(PROG) $@
$(MANDIR)/$(MAN): $(MAN) $(MANDIR)/man1
install -p -m $(MANMODE) $(MAN) $@
install: $(BINDIR)/$(PROG) $(MANDIR)/$(MAN)
sparse: $(PROG).c
$(SPARSE) $(CPPFLAGS) $(CFLAGS) $(SPARSEFLAGS) $^
.PHONY: clean sparse install