-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
63 lines (51 loc) · 1.19 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
.DEFAULT_GOAL := build
unamestr := $(shell uname)
INVALID=true
ifeq ($(unamestr), Linux)
INVALID=false
endif
ifeq ($(unamestr), Darwin)
INVALID=false
endif
ifeq ($(unamestr), FreeBSD)
INVALID=false
endif
CFLAGS=`mpicc -showme:compile`
LDFLAGS=`mpicc -showme:link`
FLAGS_FILE="xautogencgoflags.go"
define XGENFLAGS
// Copyright 2021 Seth Bromberger. All rights reserved.\n\
// Copyright 2016 The Gosl Authors. All rights reserved.\n\
// Use of this source code is governed by a BSD-style\n\
// license that can be found in the LICENSE file.\n\
// *** NOTE: this file was auto generated by Makefile ***\n\
// *** and should be ignored ***\n\
\n\
// +build !windows\n\
\n\
package mpi\n\
/*\n\
#cgo CFLAGS: $(CFLAGS) \n\
#cgo LDFLAGS: $(LDFLAGS)\n\
*/\n\
import \"C\"\n
endef
xgenflags:
@echo "$(XGENFLAGS)" | sed "s/^ //g" > $(FLAGS_FILE)
valid:
@if [ "$(INVALID)" = "true" ]; then echo "Architecture $(unamestr) is not supported by this library"; exit 127; fi
gobuild:
{ \
touch *.go ; \
go generate ; \
}
goinstall: gobuild
{ \
go install ; \
}
build: valid xgenflags
install: build goinstall
test:
mpirun -n 4 --oversubscribe go test . ;
clean:
rm -f $(FLAGS_FILE)