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