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