-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working version 0.2.1 with make install target.
- Loading branch information
1 parent
853d922
commit 528d5d8
Showing
5 changed files
with
144 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,56 @@ | ||
# Makefile for PDFminion | ||
|
||
# Go parameters | ||
GOCMD=go | ||
GOBUILD=$(GOCMD) build | ||
GOCLEAN=$(GOCMD) clean | ||
GOTEST=$(GOCMD) test | ||
GOGET=$(GOCMD) get | ||
BINARY_NAME=pdfminion | ||
BINARY_UNIX=$(BINARY_NAME)_unix | ||
|
||
# Build information | ||
BUILDTIME=$(shell date -u +'%Y %b %d %H:%M') | ||
|
||
# Build flags | ||
LDFLAGS=-ldflags "-X 'pdfminion/internal/config.BuildTime=$(BUILDTIME)'" | ||
|
||
# Install directory | ||
INSTALL_DIR=/usr/local/bin | ||
|
||
.PHONY: all build clean test run install uninstall | ||
|
||
all: test build | ||
|
||
.PHONY: build | ||
build: | ||
go build -o pdfminion ./cmd/pdfminion | ||
@echo "Build Time: $(BUILDTIME)" | ||
@echo "LDFLAGS: $(LDFLAGS)" | ||
$(GOBUILD) $(LDFLAGS) -o $(BINARY_NAME) -v ./cmd/pdfminion | ||
|
||
.PHONY: install | ||
install: | ||
go install ./cmd/pdfminion | ||
test: | ||
$(GOTEST) -v ./... | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f pdfminion | ||
rm -f pdfminion.exe | ||
$(GOCLEAN) | ||
rm -f $(BINARY_NAME) | ||
rm -f $(BINARY_UNIX) | ||
|
||
run: | ||
$(GOBUILD) $(LDFLAGS) -o $(BINARY_NAME) -v ./cmd/pdfminion | ||
./$(BINARY_NAME) | ||
|
||
# Cross compilation | ||
build-linux: | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) $(LDFLAGS) -o $(BINARY_UNIX) -v ./cmd/pdfminion | ||
|
||
# Install the binary | ||
install: build | ||
@echo "Installing $(BINARY_NAME) to $(INSTALL_DIR)" | ||
@sudo mv $(BINARY_NAME) $(INSTALL_DIR)/$(BINARY_NAME) | ||
@echo "Installation complete. You can now run '$(BINARY_NAME)' from anywhere." | ||
|
||
# Uninstall the binary | ||
uninstall: | ||
@echo "Uninstalling $(BINARY_NAME) from $(INSTALL_DIR)" | ||
@sudo rm -f $(INSTALL_DIR)/$(BINARY_NAME) | ||
@echo "Uninstallation complete. $(BINARY_NAME) has been removed." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters