Merge back from 2.21-pre1
[fw/sdcc] / as / z80 / Makefile
1 PRJDIR = ../..
2
3 include $(PRJDIR)/Makefile.common
4
5 SDC     = .
6 SRC     = asdata.c asexpr.c aslex.c aslist.c asmain.c asout.c \
7           assubr.c assym.c z80adr.c z80ext.c z80mch.c z80pst.c
8 OBJS    = $(SRC:%.c=%.o)
9 BINS    = $(BUILDDIR)/as$(EXT)
10
11 CFLAGS  += $(OPTS) -I. -DINDEXLIB -DMLH_MAP -DUNIX -DSDK
12 CFLAGS  += -funsigned-char
13 LDFLAGS += -lm
14
15 all:    dep $(BINS)
16
17 dep: Makefile.dep
18
19 Makefile.dep: $(SRC) *.h
20         $(CPP) $(CPPFLAGS) $(M_OR_MM) $(SRC) > Makefile.dep
21
22 include Makefile.dep
23
24 $(BINS): $(OBJS)
25         $(CC) $(LDFLAGS) -o $(BINS) $(OBJS)
26
27 # Hmm.  Should only rebuild if any of the source files are changed,
28 # but must do a clean build to make sure that there isnt a mix of
29 # z80 and gb stuff.
30 wary: $(OBJS)
31         make clean
32         make $(BINS)
33
34 %.o:    %.c
35         $(CC) -c $(CFLAGS) -o $@ $<
36
37 clean:
38         rm -f $(OBJS) $(BINS)