+#############################################################
+# (c) 2020 Aaron Taylor <ataylor at subgeniuskitty dot com> #
+# See LICENSE.txt file for copyright and license details. #
+#############################################################
+
+
+####################################################################################################
+# GNU Executables & Flags
+
+CC = pdp11-aout-gcc
+LD = pdp11-aout-ld
+AS = pdp11-aout-as
+OC = pdp11-aout-objcopy
+OD = pdp11-aout-objdump
+
+CC_FLAGS = -c -Wall -Wno-unused-function -O0 -ffreestanding -fomit-frame-pointer -fno-builtin-alloca -std=c99
+LD_FLAGS = -T pdp11.ld --entry _start
+AS_FLAGS =
+OC_FLAGS = --only-section=.text --output-target binary
+
+
+####################################################################################################
+# Misc Configuration
+
+# Physical serial port connected to a PDP-11 for transfering program into memory.
+SERIAL_PORT = /dev/cuau0
+
+# Commands for converting raw binary into SIMH or real PDP compatible formats.
+SIM_LOAD = bin2load
+PDP_LOAD = bin2pdp
+
+# Commands for running the SIMH PDP-11 simulation.
+SIMH_CMD = pdp11
+SIMH_CFG = simh.conf
+
+# List of all source files in PDP-11 library.
+PDPLIB_SRC != ls pdp11/*.c
+
+
+####################################################################################################
+# Targets
+
+all: aout
+
+aout:
+ $(AS) $(AS_FLAGS) -o init.o init.s
+ $(CC) $(CC_FLAGS) -o pdp11.o $(PDPLIB_SRC)
+
+ ##############################################
+ # Insert your program's build commands here. #
+ $(CC) $(CC_FLAGS) -o hello.o hello.c
+ ##############################################
+
+ $(LD) $(LD_FLAGS) init.o pdp11.o hello.o -o program.out
+
+clean:
+ @rm -rf *.o *.out *.pdp11 *.bin *.core
+
+sim: aout
+ $(OC) $(OC_FLAGS) program.out program.bin
+ $(SIM_LOAD) -i program.bin -o program.pdp11 -a 01000
+ $(SIMH_CMD) $(SIMH_CFG)
+
+pdp: aout
+ $(OC) $(OC_FLAGS) program.out program.bin
+ $(PDP_LOAD) -i program.bin -o $(SERIAL_PORT)
+
+examine: aout
+ @$(OD) -d program.out