Commit | Line | Data |
---|---|---|
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 | ||
10 | CC = pdp11-aout-gcc | |
11 | LD = pdp11-aout-ld | |
12 | AS = pdp11-aout-as | |
13 | OC = pdp11-aout-objcopy | |
14 | OD = pdp11-aout-objdump | |
15 | ||
16 | CC_FLAGS = -c -Wall -Wno-unused-function -O0 -ffreestanding -fomit-frame-pointer -fno-builtin-alloca -std=c99 | |
17 | LD_FLAGS = -T pdp11.ld --entry _start | |
18 | AS_FLAGS = | |
19 | OC_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. | |
26 | SERIAL_PORT = /dev/cuau0 | |
27 | ||
28 | # Commands for converting raw binary into SIMH or real PDP compatible formats. | |
29 | SIM_LOAD = bin2load | |
30 | PDP_LOAD = bin2pdp | |
31 | ||
32 | # Commands for running the SIMH PDP-11 simulation. | |
33 | SIMH_CMD = pdp11 | |
34 | SIMH_CFG = simh.conf | |
35 | ||
846f4d60 AT |
36 | |
37 | #################################################################################################### | |
38 | # Targets | |
39 | ||
40 | all: aout | |
41 | ||
42 | aout: | |
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 | |
58 | clean: | |
59 | @rm -rf *.o *.out *.pdp11 *.bin *.core | |
60 | ||
61 | sim: 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 | ||
66 | pdp: aout | |
67 | $(OC) $(OC_FLAGS) program.out program.bin | |
68 | $(PDP_LOAD) -i program.bin -o $(SERIAL_PORT) | |
69 | ||
70 | examine: aout | |
71 | @$(OD) -d program.out |