]> git.sur5r.net Git - cc65/blob - src/ld65/make/watcom.mak
Convert the watcom makefiles for use with wine under Linux
[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 # Environment variables for the watcom compiler
9 export WATCOM  = c:\\watcom
10 export INCLUDE = $(WATCOM)\\h
11
12 # We will use the windows compiler under linux (define as empty for windows)
13 WINE = wine --
14
15 # Programs
16 AR      = $(WINE) WLIB
17 CC      = $(WINE) WCC386
18 LD      = $(WINE) WLINK
19 WSTRIP  = $(WINE) WSTRIP
20
21 LNKCFG  = ld.tmp
22
23 # Program arguments
24 CFLAGS  = -d1 -onatx -zp4 -5 -zq -w2 -i=..\\common
25
26 # Target files
27 EXE     = ld65.exe
28
29 # Create NT programs by default
30 ifndef TARGET
31 TARGET = NT
32 endif
33
34 # --------------------- OS2 ---------------------
35 ifeq ($(TARGET),OS2)
36 SYSTEM  = os2v2
37 CFLAGS  += -bt=$(TARGET)
38 endif
39
40 # -------------------- DOS4G --------------------
41 ifeq ($(TARGET),DOS32)
42 SYSTEM  = dos4g
43 CFLAGS  += -bt=$(TARGET)
44 endif
45
46 # --------------------- NT ----------------------
47 ifeq ($(TARGET),NT)
48 SYSTEM  = nt
49 CFLAGS  += -bt=$(TARGET)
50 endif
51
52 # ------------------------------------------------------------------------------
53 # Implicit rules
54
55 %.obj:  %.c
56         $(CC) $(CFLAGS) $^
57
58
59 # ------------------------------------------------------------------------------
60 # All OBJ files
61
62 OBJS =  asserts.obj     \
63         bin.obj         \
64         binfmt.obj      \
65         condes.obj      \
66         config.obj      \
67         dbgfile.obj     \
68         dbginfo.obj     \
69         dbgsyms.obj     \
70         error.obj       \
71         exports.obj     \
72         expr.obj        \
73         extsyms.obj     \
74         fileinfo.obj    \
75         fileio.obj      \
76         filepath.obj    \
77         fragment.obj    \
78         global.obj      \
79         library.obj     \
80         lineinfo.obj    \
81         main.obj        \
82         mapfile.obj     \
83         o65.obj         \
84         objdata.obj     \
85         objfile.obj     \
86         scanner.obj     \
87         segments.obj    \
88         spool.obj       \
89         tgtcfg.obj
90
91 LIBS = ../common/common.lib
92
93
94 # ------------------------------------------------------------------------------
95 # Main targets
96
97 all:            $(EXE)
98
99
100 # ------------------------------------------------------------------------------
101 # Other targets
102
103
104 $(EXE):         $(OBJS) $(LIBS)
105         @echo "DEBUG ALL" > $(LNKCFG)
106         @echo "OPTION QUIET" >> $(LNKCFG)
107         @echo "NAME $@" >> $(LNKCFG)
108         @for i in $(OBJS); do echo "FILE $${i}"; done >> $(LNKCFG)
109         @for i in $(LIBS); do echo "LIBRARY $${i}"; done >> $(LNKCFG)
110         @$(LD) system $(SYSTEM) @$(LNKCFG)
111         @rm $(LNKCFG)
112
113 clean:
114         @rm -f *~ core
115
116 zap:    clean
117         @rm -f *.obj $(EXE)
118
119 strip:
120         @-$(WSTRIP) $(EXE)
121