]> git.sur5r.net Git - cc65/blob - src/ld65/make/watcom.mak
Restructuring the object file format
[cc65] / src / ld65 / make / watcom.mak
1 #
2 # ld65 Makefile for the Watcom compiler (using GNU make)
3 #
4
5 # ------------------------------------------------------------------------------
6 # Generic stuff
7
8 AR      = WLIB
9 LD      = WLINK
10 LNKCFG  = ld.tmp
11
12 # --------------------- OS2 ---------------------
13 ifeq ($(TARGET),OS2)
14 SYSTEM  = os2v2
15 CC      = WCC386
16 CFLAGS  = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
17 endif
18
19 # -------------------- DOS4G --------------------
20 ifeq ($(TARGET),DOS32)
21 SYSTEM  = dos4g
22 CC      = WCC386
23 CFLAGS  = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
24 endif
25
26 # --------------------- NT ----------------------
27 ifeq ($(TARGET),NT)
28 SYSTEM  = nt
29 CC      = WCC386
30 CFLAGS  = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2
31 endif
32
33 # Add the include dir
34 CFLAGS  += -i=..\common
35
36 # ------------------------------------------------------------------------------
37 # Implicit rules
38
39 %.obj:  %.c
40         $(CC) $(CFLAGS) $^
41
42
43 # ------------------------------------------------------------------------------
44 # All OBJ files
45
46 OBJS =  bin.obj         \
47         binfmt.obj      \
48         condes.obj      \
49         config.obj      \
50         dbginfo.obj     \
51         dbgsyms.obj     \
52         error.obj       \
53         exports.obj     \
54         expr.obj        \
55         extsyms.obj     \
56         fileinfo.obj    \
57         fileio.obj      \
58         filepath.obj    \
59         fragment.obj    \
60         global.obj      \
61         library.obj     \
62         lineinfo.obj    \
63         main.obj        \
64         mapfile.obj     \
65         o65.obj         \
66         objdata.obj     \
67         objfile.obj     \
68         scanner.obj     \
69         segments.obj    \
70         spool.obj       \
71         tgtcfg.obj
72
73 LIBS = ..\common\common.lib
74
75
76 # ------------------------------------------------------------------------------
77 # Main targets
78
79 all:            ld65
80
81 ld65:           ld65.exe
82
83
84 # ------------------------------------------------------------------------------
85 # Other targets
86
87
88 ld65.exe:       $(OBJS) $(LIBS)
89         @echo DEBUG ALL > $(LNKCFG)
90         @echo OPTION QUIET >> $(LNKCFG)
91         @echo NAME $@ >> $(LNKCFG)
92         @for %%i in ($(OBJS)) do echo FILE %%i >> $(LNKCFG)
93         @for %%i in ($(LIBS)) do echo LIBRARY %%i >> $(LNKCFG)
94         $(LD) system $(SYSTEM) @$(LNKCFG)
95         @rm $(LNKCFG)
96
97
98 clean:
99         @if exist *.obj del *.obj
100         @if exist *.obj del ld65.exe
101
102 strip:
103         @-wstrip ld65.exe
104