From 24271b43a4bb149a3904ad2a1e4fdf439d654ad0 Mon Sep 17 00:00:00 2001 From: Aaron Taylor Date: Sun, 2 May 2021 20:38:24 -0700 Subject: [PATCH] Added framework for experimenting using Go. --- chapter-1-experiments/Makefile | 29 +++++++++++++++++++ chapter-1-experiments/ch1-breeding-numbers.go | 12 ++++++++ common/mk.conf | 21 ++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 chapter-1-experiments/Makefile create mode 100644 chapter-1-experiments/ch1-breeding-numbers.go create mode 100644 common/mk.conf diff --git a/chapter-1-experiments/Makefile b/chapter-1-experiments/Makefile new file mode 100644 index 0000000..e3e9265 --- /dev/null +++ b/chapter-1-experiments/Makefile @@ -0,0 +1,29 @@ +# © 2021 Aaron Taylor +# See LICENSE.txt file for copyright and license details. + +#################################################################################################### +# Program-specific options + +SOURCE != ls *.go +BINARY := ${SOURCE:.go=} + +#################################################################################################### +# Globally-mandated options + +include ../common/mk.conf + +all: ${BINARY} + +.go: + @${GOCC} ${GOCC_FLAGS} ${GOLD_FLAGS} -o $@ $< + +clean: + @rm -f ${BINARY} + +install: all + @mkdir -p ${BINPREFIX} + @cp -f ${BINARY} ${BINPREFIX}/surreal-${BINARY} + @chmod 755 ${BINPREFIX}/surreal-${BINARY} + +uninstall: all + @rm -f ${BINPREFIX}/surreal-${BINARY} diff --git a/chapter-1-experiments/ch1-breeding-numbers.go b/chapter-1-experiments/ch1-breeding-numbers.go new file mode 100644 index 0000000..1e53fc3 --- /dev/null +++ b/chapter-1-experiments/ch1-breeding-numbers.go @@ -0,0 +1,12 @@ +// (c) 2020 Aaron Taylor +// See LICENSE.txt file for copyright and license details. + +package main + +import ( + "fmt" +) + +func main() { + fmt.Println("Hello, World!") +} diff --git a/common/mk.conf b/common/mk.conf new file mode 100644 index 0000000..3fa6ba1 --- /dev/null +++ b/common/mk.conf @@ -0,0 +1,21 @@ +# © 2021 Aaron Taylor +# See LICENSE.txt file for copyright and license details. + +#################################################################################################### +# Installation Paths + +PREFIX = /home/ataylor/ +BINPREFIX = ${PREFIX}/bin + +#################################################################################################### +# Configuration + +CC = cc +CC_FLAGS = -Wall -std=c99 -pedantic -Wno-deprecated-declarations -O2 +LD_FLAGS = + +GOCC = go build +GOCC_FLAGS = +GOLD_FLAGS = + +.SUFFIXES: .go .c -- 2.20.1