Skip to content

Commit

Permalink
111.dockter.1 (#112)
Browse files Browse the repository at this point in the history
* #111 Refactor Makefiles to directory

* #111 Refactor Makefiles to directory

* #111 Refactor Makefiles to directory

* #111 Refactor Makefiles to directory

* #111 Refactor Makefiles to directory
  • Loading branch information
docktermj authored Dec 5, 2023
1 parent 5e9d84b commit 78bcc70
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker-push-containers-to-dockerhub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ jobs:
image-repository: senzing/test-ground
image-tag: ${{ github.ref_name }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
platforms: "linux/amd64,linux/arm64"
username: ${{ secrets.DOCKERHUB_USERNAME }}
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Detect the operating system and architecture.

include Makefile.osdetect
include makefiles/osdetect.mk

# -----------------------------------------------------------------------------
# Variables
Expand All @@ -12,7 +12,7 @@ include Makefile.osdetect

# PROGRAM_NAME is the name of the GIT repository.
PROGRAM_NAME := $(shell basename `git rev-parse --show-toplevel`)
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MAKEFILE_PATH := $(abspath $(firstword $(MAKEFILE_LIST)))
MAKEFILE_DIRECTORY := $(shell dirname $(MAKEFILE_PATH))
TARGET_DIRECTORY := $(MAKEFILE_DIRECTORY)/target
DOCKER_CONTAINER_NAME := $(PROGRAM_NAME)
Expand Down Expand Up @@ -52,8 +52,8 @@ default: help
# Operating System / Architecture targets
# -----------------------------------------------------------------------------

-include Makefile.$(OSTYPE)
-include Makefile.$(OSTYPE)_$(OSARCH)
-include makefiles/$(OSTYPE).mk
-include makefiles/$(OSTYPE)_$(OSARCH).mk


.PHONY: hello-world
Expand All @@ -74,7 +74,7 @@ dependencies:
# - docker-build: https://docs.docker.com/engine/reference/commandline/build/
# -----------------------------------------------------------------------------

PLATFORMS := darwin/amd64 linux/amd64 windows/amd64
PLATFORMS := darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 windows/amd64 windows/arm64
$(PLATFORMS):
@echo Building $(TARGET_DIRECTORY)/$(GO_OS)-$(GO_ARCH)/$(PROGRAM_NAME)
@GOOS=$(GO_OS) GOARCH=$(GO_ARCH) go build -o $(TARGET_DIRECTORY)/$(GO_OS)-$(GO_ARCH)/$(PROGRAM_NAME)
Expand All @@ -87,6 +87,7 @@ build: build-osarch-specific
.PHONY: build-all $(PLATFORMS)
build-all: $(PLATFORMS)
@mv $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME) $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME).exe
@mv $(TARGET_DIRECTORY)/windows-arm64/$(PROGRAM_NAME) $(TARGET_DIRECTORY)/windows-arm64/$(PROGRAM_NAME).exe


.PHONY: build-scratch
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ It also shows best practices that can be retro-fitted into existing repositories
[![gosec.yaml](https://github.com/Senzing/template-go/actions/workflows/gosec.yaml/badge.svg)](https://github.com/Senzing/template-go/actions/workflows/gosec.yaml)
[![go-test-linux.yaml](https://github.com/Senzing/template-go/actions/workflows/go-test-linux.yaml/badge.svg)](https://github.com/Senzing/template-go/actions/workflows/go-test-linux.yaml)
[![go-test-darwin.yaml](https://github.com/Senzing/template-go/actions/workflows/go-test-darwin.yaml/badge.svg)](https://github.com/Senzing/template-go/actions/workflows/go-test-darwin.yaml)
[![bob-go-test-windows.yaml](https://github.com/Senzing/template-go/actions/workflows/go-test-windows.yaml/badge.svg)](https://github.com/Senzing/template-go/actions/workflows/go-test-windows.yaml)
[![go-test-windows.yaml](https://github.com/Senzing/template-go/actions/workflows/go-test-windows.yaml/badge.svg)](https://github.com/Senzing/template-go/actions/workflows/go-test-windows.yaml)

## Overview

Expand Down
2 changes: 1 addition & 1 deletion Makefile.darwin → makefiles/darwin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LD_LIBRARY_PATH := $(SENZING_TOOLS_SENZING_DIRECTORY)/lib:$(SENZING_TOOLS_SENZIN
DYLD_LIBRARY_PATH := $(LD_LIBRARY_PATH)

# -----------------------------------------------------------------------------
# OS-ARCH specific targets
# OS specific targets
# -----------------------------------------------------------------------------

.PHONY: build-osarch-specific
Expand Down
16 changes: 16 additions & 0 deletions makefiles/darwin_arm64.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Makefile extensions for darwin-arm64.

# -----------------------------------------------------------------------------
# OS-ARCH specific targets
# -----------------------------------------------------------------------------

.PHONY: build-osarch-specific
build-osarch-specific: darwin/arm64

# -----------------------------------------------------------------------------
# Makefile targets supported only by this platform.
# -----------------------------------------------------------------------------

.PHONY: only-darwin-arm64
only-darwin-arm64:
@echo "Only darwin-arm64 has this Makefile target."
16 changes: 16 additions & 0 deletions makefiles/darwin_x86_64.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Makefile extensions for darwin-x86_64.

# -----------------------------------------------------------------------------
# OS-ARCH specific targets
# -----------------------------------------------------------------------------

.PHONY: build-osarch-specific
build-osarch-specific: darwin/amd64

# -----------------------------------------------------------------------------
# Makefile targets supported only by this platform.
# -----------------------------------------------------------------------------

.PHONY: only-darwin-x86_64
only-darwin-x86_64:
@echo "Only darwin-x86_64 has this Makefile target."
2 changes: 1 addition & 1 deletion Makefile.linux → makefiles/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


# -----------------------------------------------------------------------------
# OS-ARCH specific targets
# OS specific targets
# -----------------------------------------------------------------------------

.PHONY: build-osarch-specific
Expand Down
16 changes: 16 additions & 0 deletions makefiles/linux_arm64.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Makefile extensions for linux-arm64.

# -----------------------------------------------------------------------------
# OS-ARCH specific targets
# -----------------------------------------------------------------------------

.PHONY: build-osarch-specific
build-osarch-specific: linux/arm64

# -----------------------------------------------------------------------------
# Makefile targets supported only by this platform.
# -----------------------------------------------------------------------------

.PHONY: only-linux-arm64
only-linux-arm64:
@echo "Only linux-arm64 has this Makefile target."
16 changes: 16 additions & 0 deletions makefiles/linux_x86_64.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Makefile extensions for linux-x86_64.

# -----------------------------------------------------------------------------
# OS-ARCH specific targets
# -----------------------------------------------------------------------------

.PHONY: build-osarch-specific
build-osarch-specific: linux/amd64

# -----------------------------------------------------------------------------
# Makefile targets supported only by this platform.
# -----------------------------------------------------------------------------

.PHONY: only-linux-x86_64
only-linux-x86_64:
@echo "Only linux-x86_64 has this Makefile target."
File renamed without changes.
2 changes: 1 addition & 1 deletion Makefile.windows → makefiles/windows.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


# -----------------------------------------------------------------------------
# OS-ARCH specific targets
# OS specific targets
# -----------------------------------------------------------------------------

.PHONY: build-osarch-specific
Expand Down
17 changes: 17 additions & 0 deletions makefiles/windows_arm64.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Makefile extensions for windows-arm64.

# -----------------------------------------------------------------------------
# OS-ARCH specific targets
# -----------------------------------------------------------------------------

.PHONY: build-osarch-specific
build-osarch-specific: windows/arm64
@mv $(TARGET_DIRECTORY)/windows-arm64/$(PROGRAM_NAME) $(TARGET_DIRECTORY)/windows-arm64/$(PROGRAM_NAME).exe

# -----------------------------------------------------------------------------
# Makefile targets supported only by this platform.
# -----------------------------------------------------------------------------

.PHONY: only-windows-arm64
only-windows-arm64:
@echo "Only windows-arm64 has this Makefile target."
17 changes: 17 additions & 0 deletions makefiles/windows_x86_64.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Makefile extensions for windows.

# -----------------------------------------------------------------------------
# OS-ARCH specific targets
# -----------------------------------------------------------------------------

.PHONY: build-osarch-specific
build-osarch-specific: windows/amd64
@mv $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME) $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME).exe

# -----------------------------------------------------------------------------
# Makefile targets supported only by this platform.
# -----------------------------------------------------------------------------

.PHONY: only-windows-x86_64
only-windows-x86_64:
@echo "Only windows-x86_64 has this Makefile target."

0 comments on commit 78bcc70

Please sign in to comment.