11
22all : label.exe
33
4+ ifndef compiler
5+ compiler: =watcom
6+ endif
7+
8+
9+ # misc and non portable shell commands needed
10+ # trick to auto determine OS, assumes PATH env var set with at least 2 components (i.e. ; or : separated)
11+ ifneq '$(findstring ;,$(PATH ) ) ' ';'
12+ LINUX: =1
13+ # Note: ensure no extra whitespace after DIRSEP
14+ DIRSEP =/
15+ RM =@rm -f
16+ CP =cp
17+ else
18+ # Windows or DOS
19+ # Note: ensure no extra whitespace after DIRSEP
20+ DIRSEP =\\
21+ ifeq ($(OS ) ,Windows_NT) # is Windows_NT on XP, 2000, 7, Vista, 10...
22+ # Windows specific
23+ WIN32:=1
24+ RM =@del
25+ else
26+ # DOS specific
27+ # RM=$($(ROOTPATH)utils/rmfiles.bat"
28+ RM =@rm -f
29+ endif
30+ CP =copy
31+ endif
32+
33+
34+ ifeq ($(compiler ) ,watcom)
35+ # Watcom
36+ # -0 generate code for 8086+
37+ # -bt=DOS compile for DOS
38+ # -bcl=DOS link for DOS
39+ # -s remove statck overflow checks
40+ # -zp1 pack structures align on byte
41+ # -we treat all warnings as errors
42+ # -wx set warning level to max
43+ # -zq operate quietly
44+ # -fm[=map_file] generate map file
45+ # -fe=executable name executable file
46+ # -m{t,s,m,c,l,h} memory model
47+ CC =wcl
48+ EXEFLAGS =-mt
49+ CFLAGS =-oas -bt=DOS -bcl=DOS -D__MSDOS__ -zp1 -s -0 -wx -we -zq -fm $(EXEFLAGS ) -fe=
50+ LDFLAGS =
51+ endif
52+
53+ ifeq ($(compiler ) ,borland)
54+ # Borland
55+ # -w warn -M create map -f- no floating point -Z register optimize
56+ # -O jump optimize -k- no standard stack frome -K unsigned char
57+ # -exxx executable name (must be last) -mt tiny (default is small)
58+ # -N stack checking -a- byte alignment -ln no default libs
59+ # -lt create .com file -lx no map file ...
60+ # tiny has near qsort / malloc pointers, very limited!
61+ # compact large: large has far function pointers, compact only far heap.
62+ # makes no real difference here, but compact saves a few bytes in size.
63+ # tcc looks for includes from the current directory, not the location of the
64+ # file that's trying to include them, so add kitten's location -I
65+ ifeq ($(TURBO ) ,0)
66+ CC =bcc
67+ else
68+ CC =tcc
69+ endif
70+ EXEFLAGS =-mt -Z -O -k-
71+ CFLAGS =-I../kitten -w -M -f- -a- -K -ln $(EXEFLAGS ) -e
72+ LDFLAGS =
73+ endif
74+
75+ ifeq ($(compiler ) ,gcc)
76+ ifdef LINUX
77+ # long name version
78+ CC =ia16-elf-gcc
79+ OBJCOPY =ia16-elf-objcopy
80+ else
81+ # DOS short name version
82+ CC =i16gcc
83+ OBJCOPY =i16objco
84+ endif
85+ # EXEFLAGS=-ffreestanding -mrtd
86+ EXEFLAGS =
87+ LDFLAGS =-li86
88+ CFLAGS =-I../kitten -mcmodel=small -fleading-underscore -fno-common -fpack-struct -Wno-pointer-to-int-cast -Wno-pragmas -Werror -Os -fno-strict-aliasing -fcall-used-es -mfar-function-if-far-return-type $(EXEFLAGS ) -o
89+ endif
90+
91+
492UPX =upx --8086
593# if you don't want to use UPX set
694# UPX=-rem (DOS)
@@ -11,18 +99,20 @@ UPX=upx --8086
1199# or
12100# --best for smallest
13101
102+
14103ifneq ($(findstring NOCATS,$(CFLAGS ) ) ,)
15104 KITTEN:=
16105else
17- KITTEN:=../ kitten/ kitten.c
106+ KITTEN:=..$(DIRSEP) kitten$(DIRSEP) kitten.c
18107endif
19108
20- label.exe _label.exe : prf.c label.c $(KITTEN )
109+ label.exe : prf.c label.c $(KITTEN )
21110 $(CC ) $(CFLAGS ) $@ $^ $(LDFLAGS )
22- $(UPX ) $@
111+ - $(UPX ) $@
23112
24113clean :
25114 $(RM ) label.exe
26- $(RM ) _label.exe
27115 $(RM ) * .o
28116 $(RM ) * .obj
117+ $(RM ) * .map
118+
0 commit comments