Initial commit: makefile.
authorAaron Taylor <ataylor@subgeniuskitty.com>
Fri, 25 Dec 2020 11:28:49 +0000 (03:28 -0800)
committerAaron Taylor <ataylor@subgeniuskitty.com>
Fri, 25 Dec 2020 11:28:49 +0000 (03:28 -0800)
Makefile [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..2d43f29
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,60 @@
+####################################################################################################
+# Executables
+
+CC              = pdp11-aout-gcc
+LD              = pdp11-aout-ld
+AS              = pdp11-aout-as
+OC              = pdp11-aout-objcopy
+
+####################################################################################################
+# Paths
+
+LDSCRIPT        = pdp11.ld
+####################################################################################################
+# Flags
+
+CC_FLAGS        += -c -Wall -Wno-unused-function -O0 -ffreestanding -fomit-frame-pointer -fno-builtin-alloca -std=c99
+LD_FLAGS        += -T $(LDSCRIPT) --entry _start
+AS_FLAGS        += 
+OC_FLAGS        += --only-section=.text --output-target binary
+
+####################################################################################################
+# BIN2LOAD
+
+B2L_CMD         += bin2load
+
+####################################################################################################
+# Serial Loader
+
+SLOAD           += pdp11-serial-loader
+
+####################################################################################################
+# SIMH
+
+SIMH_CMD        += pdp11
+SIMH_CFG        += simh.conf
+
+####################################################################################################
+# Targets
+
+all: aout
+
+aout: 
+       $(AS) $(AS_FLAGS) -o bootstrap.o bootstrap.s
+       $(CC) $(CC_FLAGS) -o cstart.o cstart.c
+       $(CC) $(CC_FLAGS) -o pdp11.o pdp11.c
+       $(CC) $(CC_FLAGS) -o hello.o hello.c
+       $(LD) $(LD_FLAGS) bootstrap.o cstart.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
+       $(B2L_CMD) -i program.bin -o program.pdp11 -a 01000
+       $(SIMH_CMD) $(SIMH_CFG)
+
+pdp: aout
+       $(OC) $(OC_FLAGS) program.out program.bin
+       $(SLOAD) -i program.bin -o /dev/cuau0