-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.hwloc
35 lines (26 loc) · 1.19 KB
/
Makefile.hwloc
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
# This makefile will be used when we can add hwloc - there is currently a bug.
HERE ?= $(shell pwd)
LOCALBIN ?= $(shell pwd)/bin
# Install hwloc here for use to compile, etc.
LOCALLIB ?= $(shell pwd)/lib
HWLOC_INCLUDE ?= $(LOCALLIB)/include/hwloc.h
BUILDENVVAR=CGO_CFLAGS="-I$(LOCALLIB)/include" CGO_LDFLAGS="-L$(LOCALLIB)/lib -lhwloc"
.PHONY: all
all: build
.PHONY: $(LOCALBIN)
$(LOCALBIN):
mkdir -p $(LOCALBIN)
.PHONY: $(LOCALLIB)
$(LOCALLIB):
mkdir -p $(LOCALLIB)
$(HWLOC_INCLUDE):
git clone --depth 1 https://github.com/open-mpi/hwloc /tmp/hwloc || true && \
cd /tmp/hwloc && ./autogen.sh && \
./configure --enable-static --disable-shared LDFLAGS="-static" --prefix=$(LOCALLIB)/ && \
make LDFLAGS=-all-static && make install
build: $(LOCALBIN) $(HWLOC_INCLUDE)
GO111MODULE="on" $(BUILDENVVAR) go build -ldflags '-w' -o $(LOCALBIN)/compspec cmd/compspec/compspec.go
build-arm: $(LOCALBIN) $(HWLOC_INCLUDE)
GO111MODULE="on" $(BUILDENVVAR) GOARCH=arm64 go build -ldflags '-w' -o $(LOCALBIN)/compspec-arm cmd/compspec/compspec.go
build-ppc: $(LOCALBIN) $(HWLOC_INCLUDE)
GO111MODULE="on" $(BUILDENVVAR) GOARCH=ppc64le go build -ldflags '-w' -o $(LOCALBIN)/compspec-ppc cmd/compspec/compspec.go