-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
141 lines (114 loc) · 3.03 KB
/
Makefile
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#
# GNU Makefile for HRTmon
#
# supported platforms:
# Amiga
# 'setenv AMIGA 1' for system detection
# assign Includes: must point to system includes
# requires WDate command, see WHDLoad-dev package Src/programs/WDate
# basm default, use DEBUG=0 for vasm
# Linux/MacOSX
# $INCLUDEOS3 must point to system includes
# vasm default, use DEBUG=1 for basm (requires Vamos)
# includes for reqtools.library are needed additionally (aminet:util/libs/ReqToolsDev.lha)
#
# $@ target
# $< first dependency
# $^ all dependencies
# print all make variables
#$(foreach v,$(.VARIABLES),$(info $(v) = $($(v))))
# print all make variables defined between both statements
#VARS_OLD := $(.VARIABLES)
#$(foreach v,$(filter-out $(VARS_OLD) VARS_OLD,$(.VARIABLES)),$(info $(v) = $($(v))))
# different commands for build under Amiga or UNIX
ifdef AMIGA
# basm options: -x+ = use cachefile.library -s1+ = create SAS/D1 debug hunks
BASMOPT=-x+
BASMOPTDBG=-s1+
CFLAGS=
CP=Copy Clone
MV=Copy
RM=Delete All
DATE=wdate >
# on Amiga default=DEBUG
ifndef DEBUG
DEBUG=1
endif
else
# basm options: -x- = don't use cachefile.library -sa+ = create symbol hunks
BASMOPT=-x-
BASMOPTDBG=-sa+
VASMOPT=-I$(INCLUDEOS3)
CFLAGS=-I$(INCLUDEOS3)
CP=cp -p
MV=mv
RM=rm -fr
DATE=date "+(%d.%m.%Y)" | xargs printf >
VAMOS=vamos -qC68020 -m4096 -s128 --
# on UNIX default=NoDEBUG
ifndef DEBUG
DEBUG=0
endif
endif
ifeq ($(DEBUG),1)
# Debug options
# ASM creates executables, ASMB binary files, ASMO object files
# BASM: -H to show all unused Symbols/Labels, requires -OG-
ASM=$(VAMOS) basm -v+ $(BASMOPT) $(BASMOPTDBG) -O+ -ODc- -ODd- -wo- -dDEBUG=1
ASMB=$(ASM)
ASMO=$(ASM)
ASMDEF=-d
ASMOUT=-o
CC=vc -c99 -g -I. $(CFLAGS) -sc -deps
else
# Optimize options
# VASM: -wfail -warncomm -databss
ASMBASE=vasmm68k_mot $(VASMOPT) -ignore-mult-inc -nosym -quiet -wfail -opt-allbra -opt-clr -opt-lsl -opt-movem -opt-nmoveq -opt-pea -opt-size -opt-st -depend=make -depfile .depend/[email protected]
ASM=$(ASMBASE) -Fhunkexe
ASMB=$(ASMBASE) -Fbin
ASMO=$(ASMBASE) -Fhunk
ASMDEF=-D
ASMOUT=-o
CC=vc -c99 -g -I. $(CFLAGS) -O2 -size -sc -deps
endif
# general programs
LN=vc
# objects and depend files are always created together
%.o: %.s | .depend
${ASMO} $(ASMOUT)$@ $<
%.o: %.c | .depend
$(CC) -o $@ -c $<
$(MV) $*.dep .depend/
#
# HRTmon.data (default target)
#
HRTmon.data: src/HRTmonV2.s | .depend
$(DATE) .date
$(ASM) $(ASMOUT)$@ $<
#
# HRTmon loader
#
HRTmon: HRTmon.o assembler.o HRTmonLoad.o
$(LN) $^ -o $@
#
# HRTmon preferences editor
#
HRTmonPrefs: HRTmonPrefs.o HRTmonGUI2.o HRTboot.o assembler.o HRTmonLoad.o
$(LN) $^ -o $@
all: HRTmonPrefs HRTmon HRTmon.data
# how to create additionally listing files
%.list: %.s | .depend
$(ASM) $(ASMOUT)$(@:.list=.o) -L $@ $<
HRTmon.data.list: src/HRTmonV2.s | .depend
$(DATE) .date
$(ASM) $(ASMOUT)HRTmon.data -L $@ $<
# check for unused labels
unused: HRTmon.data.list
grep " LAB .* UNUSED" *.list
clean:
$(RM) HRTmon HRTmonPrefs HRTmon.data *.o *.list .date .depend
# targets which must be always built
.PHONY: all clean unused
.depend:
@mkdir .depend
include $(wildcard .depend/*)