Update svn merge history.
[sdcc.git] / sdcc / src / port.mk
blob312f6f8233464cce9f0d85285773e2f39bde6151
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.
7 # Ports are always located in sdcc/src/<portname>
9 # Output
10 LIB = port.a
11 # Include the sdcc/src directory
12 INCLUDEFLAGS = -I$(srcdir)/.. -I..
14 # If the sources aren't specified, assume all in this directory.
15 ifndef SOURCES
16 SOURCES = $(sort $(notdir $(wildcard $(srcdir)/*.c)))
17 endif
18 ifndef CXXSOURCES
19 CXXSOURCES = $(sort $(notdir $(wildcard $(srcdir)/*.cc)))
20 endif
22 # If the peephole rules aren't specified, assume all.
23 ifndef PEEPRULES
24 PEEPDEFS = $(notdir $(wildcard $(srcdir)/*.def))
25 PEEPRULES = $(PEEPDEFS:.def=.rul)
26 endif
28 PREBUILD += $(PEEPRULES)
30 all: $(PREBUILD) dep $(LIB)
32 include $(top_builddir)/Makefile.common
34 $(LIB): $(OBJ)
35 rm -f $(LIB)
36 $(AR) rc $(LIB) $(OBJ)
37 $(RANLIB) $(LIB)
39 %.rul: %.def
40 $(AWK) -f $(srcdir)/../SDCCpeeph.awk $< > $@
42 include $(srcdir)/../port-clean.mk