peip

ip identifier
git clone https://git.xcv.gr/git/peip.git
Log | Files | Refs | README

Makefile (910B)


      1 # Makefile for peip
      2 .PHONY: build openbsd clean install help
      3 
      4 BIN_NAME=peip
      5 BIN_PATH=/var/www/cgi-bin/$(BIN_NAME)
      6 OWNER=root:www
      7 GO=go
      8 GOOS_OPENBSD=openbsd
      9 GOARCH_OPENBSD=amd64
     10 LDFLAGS_OPENBSD=-linkmode external -extldflags -static
     11 
     12 all: build
     13 ## build: build project for the current host (non-openbsd)
     14 build:
     15 	$(GO) build -o $(BIN_NAME) .
     16 ## openbsd: cross-build a static binary for openbsd/amd64
     17 openbsd:
     18 	GOOS=$(GOOS_OPENBSD) GOARCH=$(GOARCH_OPENBSD) $(GO) build -ldflags "$(LDFLAGS_OPENBSD)" -o $(BIN_NAME) .
     19 ## clean: cleanup current and destination project binaries
     20 clean:
     21 	rm -f $(BIN_PATH)
     22 	rm -f $(BIN_NAME)
     23 
     24 ## install: build for openbsd and place in destination directories
     25 install: openbsd
     26 	mkdir -p $(dir $(BIN_PATH))
     27 	cp $(BIN_NAME) $(BIN_PATH)
     28 	chmod 755 $(BIN_PATH)
     29 	-chown $(OWNER) $(BIN_PATH)
     30 ## help: this help
     31 help:
     32 	@echo "Available targets:"
     33 	@grep -E '^## ' Makefile | sed 's/^## /:: /'