File: Makefile

package info (click to toggle)
haskell-futhark 0.25.32-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 18,236 kB
  • sloc: haskell: 100,484; ansic: 12,100; python: 3,440; yacc: 785; sh: 561; javascript: 558; lisp: 399; makefile: 277
file content (51 lines) | stat: -rw-r--r-- 1,207 bytes parent folder | download | duplicates (2)
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
FUTHARK_BACKEND ?= c

ifeq ($(FUTHARK_BACKEND),opencl)
CFLAGS=-O3 -std=c99
LDFLAGS=-lm -lOpenCL
else ifeq ($(FUTHARK_BACKEND),multicore)
CFLAGS=-O3 -std=c99
LDFLAGS=-lm
else ifeq ($(FUTHARK_BACKEND),ispc)
CFLAGS=-O3 -std=c99
LDFLAGS=-lm
ISPCFLAGS=--woff --pic --addressing=64
else ifeq ($(FUTHARK_BACKEND),cuda)
CFLAGS=-O3 -std=c99
LDFLAGS=-lm -lcuda -lcudart -lnvrtc
else ifeq ($(FUTHARK_BACKEND),hip)
CFLAGS=-O3 -std=c99
LDFLAGS=-lm -lamdhip64 -lhiprtc
else
CFLAGS=-O3 -std=c99
LDFLAGS=-lm
endif

.SECONDARY:

.PHONY: test clean

test: $(patsubst %.fut, do_test_%, $(wildcard *.fut))

do_test_%: test_%
	./validatemanifest.py ../../docs/manifest.schema.json $*.json
	./test_$*

test_%: test_%.c %.o
  ifeq ($(FUTHARK_BACKEND),ispc)
	gcc -o $@ $^ $(patsubst test_%, %_ispc.o, $@) -Wall -Wextra -pedantic -std=c99 $(LDFLAGS) -lpthread
  else
	gcc -o $@ $^ -Wall -Wextra -pedantic -std=c99 $(LDFLAGS) -lpthread
  endif

%.o: %.c
  ifeq ($(FUTHARK_BACKEND),ispc)
	ispc -o $*_ispc.o $*.kernels.ispc $(ISPCFLAGS)
  endif
	gcc $*.c -c $(CFLAGS)

%.c: %.fut
	futhark $(FUTHARK_BACKEND) --library $^

clean:
	rm -rf $(patsubst %.c, %, $(wildcard test_*.c)) *.h *.o *.ispc $(patsubst %.fut, %.c, $(wildcard *.fut))