]> git.sur5r.net Git - cc65/blob - src/da65/make/gcc.mak
Makefile cleanup. Among other things, allow use of the --as-needed linker flag
[cc65] / src / da65 / make / gcc.mak
1 #
2 # gcc Makefile for da65
3 #
4
5 # ------------------------------------------------------------------------------
6
7 # The executable to build
8 EXE     = da65
9
10 # Library dir
11 COMMON  = ../common
12
13 CFLAGS = -g -O2 -Wall -W -std=c89 -I$(COMMON)
14 CC=gcc
15 EBIND=emxbind
16 LDFLAGS=
17
18 OBJS =  asminc.o        \
19         attrtab.o       \
20         code.o          \
21         comments.o      \
22         data.o          \
23         error.o         \
24         global.o        \
25         handler.o       \
26         infofile.o      \
27         labels.o        \
28         main.o          \
29         opc6502.o       \
30         opc65816.o      \
31         opc65c02.o      \
32         opc65sc02.o     \
33         opctable.o      \
34         output.o        \
35         scanner.o       \
36         segment.o
37
38 LIBS = $(COMMON)/common.a
39
40
41 # ------------------------------------------------------------------------------
42 # Makefile targets
43
44 # Main target - must be first
45 .PHONY: all
46 ifeq (.depend,$(wildcard .depend))
47 all:    $(EXE)
48 include .depend
49 else
50 all:    depend
51         @$(MAKE) -f make/gcc.mak all
52 endif
53
54 $(EXE): $(OBJS) $(LIBS)
55         $(CC) $^ $(LDFLAGS) -o $@
56         @if [ $(OS2_SHELL) ] ;  then $(EBIND) $(EXE) ; fi
57
58 clean:
59         $(RM) *~ core.* *.map
60
61 zap:    clean
62         $(RM) *.o $(EXE) .depend
63
64 # ------------------------------------------------------------------------------
65 # Make the dependencies
66
67 .PHONY: depend dep
68 depend dep:     $(OBJS:.o=.c)
69         @echo "Creating dependency information"
70         $(CC) $(CFLAGS) -MM $^ > .depend
71
72