Imported slu/mmu/interrupt/register code from WIP memtester program into C template.
[pdp11-modern-c] / Makefile
CommitLineData
846f4d60
AT
1#############################################################
2# (c) 2020 Aaron Taylor <ataylor at subgeniuskitty dot com> #
3# See LICENSE.txt file for copyright and license details. #
4#############################################################
5
6
7####################################################################################################
8# GNU Executables & Flags
9
10CC = pdp11-aout-gcc
11LD = pdp11-aout-ld
12AS = pdp11-aout-as
13OC = pdp11-aout-objcopy
14OD = pdp11-aout-objdump
15
16CC_FLAGS = -c -Wall -Wno-unused-function -O0 -ffreestanding -fomit-frame-pointer -fno-builtin-alloca -std=c99
17LD_FLAGS = -T pdp11.ld --entry _start
18AS_FLAGS =
19OC_FLAGS = --only-section=.text --output-target binary
20
21
22####################################################################################################
23# Misc Configuration
24
25# Physical serial port connected to a PDP-11 for transfering program into memory.
26SERIAL_PORT = /dev/cuau0
27
28# Commands for converting raw binary into SIMH or real PDP compatible formats.
29SIM_LOAD = bin2load
30PDP_LOAD = bin2pdp
31
32# Commands for running the SIMH PDP-11 simulation.
33SIMH_CMD = pdp11
34SIMH_CFG = simh.conf
35
846f4d60
AT
36
37####################################################################################################
38# Targets
39
40all: aout
41
42aout:
43 $(AS) $(AS_FLAGS) -o init.o init.s
202004d5
AT
44 $(AS) $(AS_FLAGS) -o pdp11_inthandler.o pdp11/interrupt_handler.s
45 $(CC) $(CC_FLAGS) -o pdp11_interrupt.o pdp11/pdp11_interrupt.c
46 $(CC) $(CC_FLAGS) -o pdp11_slu.o pdp11/pdp11_slu.c
47 $(CC) $(CC_FLAGS) -o pdp11_mmu.o pdp11/pdp11_mmu.c
48 $(CC) $(CC_FLAGS) -o pdp11.o pdp11/pdp11.c
846f4d60
AT
49
50 ##############################################
51 # Insert your program's build commands here. #
52 $(CC) $(CC_FLAGS) -o hello.o hello.c
53 ##############################################
54
202004d5
AT
55 $(LD) $(LD_FLAGS) init.o pdp11_inthandler.o pdp11_interrupt.o pdp11_slu.o pdp11_mmu.o pdp11.o \
56 hello.o -o program.out
846f4d60
AT
57
58clean:
59 @rm -rf *.o *.out *.pdp11 *.bin *.core
60
61sim: aout
62 $(OC) $(OC_FLAGS) program.out program.bin
63 $(SIM_LOAD) -i program.bin -o program.pdp11 -a 01000
64 $(SIMH_CMD) $(SIMH_CFG)
65
66pdp: aout
67 $(OC) $(OC_FLAGS) program.out program.bin
68 $(PDP_LOAD) -i program.bin -o $(SERIAL_PORT)
69
70examine: aout
71 @$(OD) -d program.out