-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
131 lines (107 loc) · 2.59 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
#
# GNU Makefile for wtools
#
# 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)
#
# $@ 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
DATE=wdate >.date
MV=Copy
RM=Delete All
# 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) -Isources
CFLAGS=-I$(INCLUDEOS3)
CP=cp -p
DATE=date "+(%d.%m.%Y)" | xargs printf >.date
MV=mv
RM=rm -fr
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 -g -Iincludes $(CFLAGS) -sc
LN=vc -g
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 -Iincludes $(CFLAGS) -O2 -size -sc
LN=vc
endif
# objects and depend files are always created together
%.o: %.s | .depend
${ASMO} $(ASMOUT)$@ $<
%.o: %.c | .depend
$(CC) -deps -o $@ -c $<
$(MV) $*.dep .depend/
#
# WArc
#
WArc: WArc.c
$(CC) -o $@ $<
#
# SaveMem
#
SaveMem: SaveMem.asm | .depend
$(DATE)
${ASM} $(ASMOUT)$@ $<
#
# ViewT
#
ViewT: ViewT.c
$(CC) -o $@ $<
all: SaveMem ViewT WArc
# how to create additionally listing files
%.list: %.s | .depend
$(ASM) $(ASMOUT)$(@:.list=.o) -L $@ $<
clean:
$(RM) *.o *.list .date .depend SaveMem ViewT WArc
# targets which must always built
.PHONY: all clean unused
.depend:
@mkdir .depend
include $(wildcard .depend/*)