Use 'ao-dbg' instead of 's51' to communicate with TeleMetrum
[fw/sdcc] / src / port.mk
1 # Common Makefile for all ports.
2 # Input: SOURCES - list of C files included in the project
3 #        SPECIAL - list of special files that should be included in dependencies
4 #        PEEPRULES - list of all peephole rules (.rul) derrived files
5 #        PREBUILD - list of special files to build before deps.
6
7 # Ports are always located in sdcc/src/<portname>
8
9 # Output
10 LIB = port.a
11 # Include the sdcc/src directory
12 INCLUDEFLAGS = -I$(srcdir)/.. -I..
13
14 # If the sources aren't specified, assume all in this directory.
15 ifndef SOURCES
16 SOURCES = $(notdir $(wildcard $(srcdir)/*.c))
17 endif
18
19 # If the peephole rules aren't specified, assume all.
20 ifndef PEEPRULES
21 PEEPDEFS = $(notdir $(wildcard $(srcdir)/*.def))
22 PEEPRULES = $(PEEPDEFS:.def=.rul)
23 endif
24
25 PREBUILD += $(PEEPRULES)
26
27 all: $(PREBUILD) dep $(LIB)
28
29 include $(top_builddir)/Makefile.common
30
31 $(LIB): $(OBJ)
32         rm -f $(LIB)
33         $(AR) r $(LIB) $(OBJ)
34         $(RANLIB) $(LIB)
35
36 %.rul: %.def
37         $(AWK) -f $(srcdir)/../SDCCpeeph.awk $< > $@
38
39 dep: Makefile.dep
40
41 Makefile.dep: $(PREBUILD) Makefile $(SOURCES) $(SPECIAL)
42         $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) >Makefile.dep
43
44 # don't include Makefile.dep for the listed targets:
45 ifeq "$(findstring $(MAKECMDGOALS),clean distclean)" ""
46   -include Makefile.dep
47 endif
48
49 include $(srcdir)/../port-clean.mk