13 top_srcdir = @srcdir@/../..
14 SLIB = $(top_builddir)support/Util
15 SDCCLIB = $(top_builddir)src
21 exec_prefix = @exec_prefix@
25 includedir = @includedir@
27 man1dir = $(mandir)/man1
28 man2dir = $(mandir)/man2
31 STD_INC = @sdcc_include_dir@
32 CPPFLAGS = @CPPFLAGS@ -I. -I$(top_builddir) -I$(top_srcdir) -I$(srcdir)/$(SLIB) -DHAVE_CONFIG_H
39 LIBS = @LIBS@ @LIBREADLINE@
42 OBJECTS = sdcdb.o symtab.o simi.o \
44 SLIBOBJS = NewAlloc.o SDCCerr.o
45 SDCCOBJS = SDCCset.o SDCChasht.o
47 SOURCES = $(patsubst %.o,%.c,$(OBJECTS))
48 SLIBSOURCES = $(patsubst %.o,$(SLIB)/%.c,$(SLIBOBJS))
49 SDCCSOURCES = $(patsubst %.o,$(SDCCLIB)/%.c,$(SDCCOBJS))
51 TARGET = $(top_builddir)bin/sdcdb$(EXEEXT)
54 # Compiling entire program or any subproject
55 # ------------------------------------------
56 all: checkconf $(TARGET)
58 # Compiling and installing everything and runing test
59 # ---------------------------------------------------
60 install: all installdirs
61 $(INSTALL) $(TARGET) $(DESTDIR)$(bindir)/sdcdb$(EXEEXT)
62 $(STRIP) $(DESTDIR)$(bindir)/sdcdb$(EXEEXT)
63 cp $(srcdir)/sdcdb.el $(DESTDIR)$(bindir)/sdcdb.el
64 cp $(srcdir)/sdcdbsrc.el $(DESTDIR)$(bindir)/sdcdbsrc.el
67 # Deleting all the installed files
68 # --------------------------------
70 rm -f $(DESTDIR)$(bindir)/sdcdb$(EXEEXT)
71 rm -f $(DESTDIR)$(bindir)/sdcdb.el
72 rm -f $(DESTDIR)$(bindir)/sdcdbsrc.el
74 # Performing self-test
75 # --------------------
79 # Performing installation test
80 # ----------------------------
84 # Creating installation directories
85 # ---------------------------------
87 $(INSTALL) -d $(DESTDIR)$(bindir)
90 # Creating dependencies
91 # ---------------------
94 Makefile.dep: $(SOURCES) $(SLIBSOURCES) $(SDCCSOURCES) $(srcdir)/*.h $(top_builddir)*.h $(top_srcdir)/*.h
95 $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) >Makefile.dep
97 ifeq "$(findstring $(MAKECMDGOALS),uninstall installcheck installdirs checkconf \
98 clean distclean mostlyclean realclean)" ""
101 include $(srcdir)/clean.mk
105 $(TARGET): $(OBJECTS) $(SLIBOBJS) $(SDCCOBJS)
106 $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(SLIBOBJS) $(SDCCOBJS) $(LIBDIRS) $(LIBS)
109 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
111 $(SLIBOBJS):%.o:$(SLIB)/%.c
112 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
114 $(SDCCOBJS):%.o:$(SDCCLIB)/%.c
115 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
117 # Remaking configuration
118 # ----------------------
120 @if [ -f $(top_builddir)devel ]; then\
121 $(MAKE) -f conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" freshconf;\
124 # End of cpp/Makefile