2023-04-22 08:37:23 +00:00
|
|
|
# SPDX-FileCopyrightText: 2019 Kent Gibson <warthog618@gmail.com>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
GOCMD=go
|
|
|
|
GOBUILD=$(GOCMD) build
|
|
|
|
GOCLEAN=$(GOCMD) clean
|
|
|
|
|
|
|
|
VERSION ?= $(shell git describe --tags --always --dirty 2> /dev/null )
|
|
|
|
LDFLAGS=-ldflags "-X=main.version=$(VERSION)"
|
|
|
|
|
|
|
|
spis=$(patsubst %.go, %, $(wildcard example/spi/*/*.go))
|
|
|
|
examples=$(patsubst %.go, %, $(wildcard example/*/*.go))
|
|
|
|
bins= $(spis) $(examples)
|
|
|
|
|
2024-06-15 13:58:47 +00:00
|
|
|
cli=$(patsubst %.go, %, $(wildcard cli/gpio*.go))
|
2023-04-22 08:37:23 +00:00
|
|
|
|
|
|
|
all: tools $(bins)
|
|
|
|
|
2024-06-15 13:58:47 +00:00
|
|
|
$(cli) : % : %.go
|
2023-04-22 08:37:23 +00:00
|
|
|
cd $(@D); \
|
2024-06-15 13:58:47 +00:00
|
|
|
$(GOBUILD) -o gpiocdev $(LDFLAGS)
|
2023-04-22 08:37:23 +00:00
|
|
|
|
|
|
|
$(bins) : % : %.go
|
|
|
|
cd $(@D); \
|
|
|
|
$(GOBUILD)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(GOCLEAN) ./...
|
2024-06-15 13:58:47 +00:00
|
|
|
rm cli/gpiocdev
|
2023-04-22 08:37:23 +00:00
|
|
|
|
2024-06-15 13:58:47 +00:00
|
|
|
tools: $(cli)
|
2023-04-22 08:37:23 +00:00
|
|
|
|