forked from virtualagc/virtualagc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.inc
115 lines (97 loc) · 3.45 KB
/
Makefile.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright: Public domain.
# Filename: Makefile.inc
# Purpose: Makefile include for all flights.
# Contact: Ron Burkey <info@sandroid.org>.
# Website: http://www.ibiblio.org/apollo
# Mod history: 2016-10-04 JL Created.
# 2016-10-04 JL Added format target.
# 2016-10-05 JL Re-enable HTML output.
# 2016-10-11 RSB The executable and html are now built separately,
# rather than in one step, since they actually
# need different command-line switches in yaYUL
# for optimum prettiness.
# 2016-10-21 RSB Hadn't been accounting for the fact that
# oct2bin need different args for --block1.
# 2016-11-07 RSB The 2016-10-11 change must have broken building
# the HTML for Validation.agc, which in turn
# broke the ability to build the installer
# for VirtualAGC.
# 2016-11-11 RSB Added the (optional) EXTRA_TARGETS.
# Notes:
#
# 1. `BASENAME` must be set in the calling Makefile to the flight name.
#
# 2. Define `NO_BINSOURCE in those missions that do not have a binsource image.
#
# 3. For normal missions, a binsource is used to generate a known-good bin
# image, and the output of yaYUL is compared against it to check for
# correctness.
#
# 4. For `Validation`, or for missions where we do not have a known-good
# image, the bin file generated by yaYUL is used as is.
#
# 5. To get yaYUL to generate HTML output, define `GEN_HTML`.
# Used by the install target, whatever that's for.
ifndef PREFIX
PREFIX=/usr/local
endif
# I removed YAYUL_ARGS, since it was basically used only one place,
# and each of the uses of yaYUL below uses different arguments.
# Enable/disable HTML generation.
GEN_HTML=yes
TARGETS=$(BASENAME).bin $(BASENAME).lst $(BASENAME).symtab
ifeq "$(BASENAME)" "Validation"
TARGETS+=$(BASENAME).txt
TOPLEVEL=Validation
else
TOPLEVEL=MAIN
endif
ifeq "$(GEN_HTML)" "yes"
TARGETS+=$(TOPLEVEL).agc.html
endif
SOURCE:=$(wildcard *.agc)
default: $(TARGETS) $(EXTRA_TARGETS)
ifdef NO_BINSOURCE
$(BASENAME).bin: $(TOPLEVEL).agc.bin
mv -f $< $@
else
$(BASENAME).bin: $(BASENAME).binsource
../Tools/oct2bin $(OCT2BIN_ARGS) <$(BASENAME).binsource
mv oct2bin.bin $@
endif
$(BASENAME).txt: $(BASENAME).bin
../Tools/webb2burkey-rope $(BASENAME).bin $(BASENAME).txt
# Assemble the actual source files.
$(TOPLEVEL).agc.bin $(TOPLEVEL).agc.lst: $(SOURCE)
../yaYUL/yaYUL --unpound-page $(EXTRA_YAYUL_ARGS) $(TOPLEVEL).agc >$(TOPLEVEL).agc.lst
# Generate HTML.
$(TOPLEVEL).agc.html: $(SOURCE)
../yaYUL/yaYUL --html $(EXTRA_YAYUL_ARGS) $(TOPLEVEL).agc >/dev/null
# Compare rope images, and rename output files.
$(BASENAME).lst: $(TOPLEVEL).agc.bin $(TOPLEVEL).agc.lst $(BASENAME).bin
ifndef NO_BINSOURCE
diff -s $(TOPLEVEL).agc.bin $(BASENAME).bin
endif
mv $(TOPLEVEL).agc.lst $(BASENAME).lst
$(BASENAME).symtab: $(BASENAME).lst
mv $(TOPLEVEL).agc.symtab $(BASENAME).symtab
corediff.txt: $(BASENAME).bin $(TOPLEVEL).agc.bin $(TOPLEVEL).agc.lst
ifdef NO_BINSOURCE
@echo "No corediff for Validation!"
else
python ../Tools/ropediff.py -p -c -a -o $@ $(BASENAME).bin $(TOPLEVEL).agc.bin
endif
clean:
-rm -f *.lst *~ $(TOPLEVEL).agc.bin $(BASENAME).bin \
*.symtab oct2bin.bin* *.html $(EXTRA_TARGETS)
# Recipe for reformatting an AGC source file.
%.agc.out: %.agc
../yaYUL/yaYUL --unpound-page $(EXTRA_YAYUL_ARGS) --format $< >$@
ifeq "$(REFORMAT)" "yes"
mv -f $@ $<
endif
# Reformat all AGC source files.
format: $(SOURCE:.agc=.agc.out)
install: default
cp $(BASENAME).bin ${PREFIX}/bin/
chmod ugo+r ${PREFIX}/bin/$(BASENAME).bin