* */Makefile.in: removed annoying warning:
[fw/sdcc] / src / Makefile.in
index 8dcdf7feac9e8f02d915ebefe4eea19befc06e4d..51189d438f442c379cbab79e4e21944a854c8631 100644 (file)
@@ -2,9 +2,12 @@
 #
 #
 
-PRJDIR         = ..
+srcdir         = @srcdir@
+top_srcdir     = @top_srcdir@
+top_builddir   = @top_builddir@
+VPATH =           @srcdir@
 
-include $(PRJDIR)/Makefile.common
+include $(top_builddir)/Makefile.common
 
 USE_ALT_LEX    = 0
 
@@ -15,12 +18,14 @@ PORT_LIBS   = $(PORTS:%=%/port.a)
 LIBS           = -lm @LIBS@
 
 #CFLAGS          += -Werror
+CPPFLAGS       += -I$(srcdir)
+LDFLAGS                = @LDFLAGS@
 
 ifdef SDCC_SUB_VERSION
 CFLAGS         += -DSDCC_SUB_VERSION_STR=\"$(SDCC_SUB_VERSION)\"
 endif
 
-SLIBOBJS       = SDCCerr.o NewAlloc.o MySystem.o BuildCmd.o dbuf.o findme.o
+SLIBOBJS       = SDCCerr.o NewAlloc.o MySystem.o BuildCmd.o dbuf.o dbuf_string.o findme.o
 
 OBJECTS        = SDCCy.o SDCChasht.o SDCCmain.o \
                  SDCCsymt.o SDCCopt.o SDCCast.o SDCCmem.o SDCCval.o \
@@ -40,31 +45,31 @@ endif
 SLIBSOURCES    = $(patsubst %.o,$(SLIB)/%.c,$(SLIBOBJS))
 SOURCES                = $(patsubst %.o,%.c,$(OBJECTS))
 
-TARGET         = $(PRJDIR)/bin/sdcc$(EXEEXT)
+TARGET         = $(top_builddir)/bin/sdcc$(EXEEXT)
 
 # Compiling entire program or any subproject
 # ------------------------------------------
-all: checkconf $(TARGET)
+all: checkconf version.h $(TARGET)
 
 $(PORT_LIBS): FORCE 
-       $(MAKE) -C `dirname $@`
+       $(MAKE) -C $(dir $@)
+
 FORCE:
 
-$(PRJDIR)/support/gc/libgc.a:
-       cd $(PRJDIR)/support/gc && $(MAKE)
+$(top_builddir)/support/gc/libgc.a:
+       $(MAKE) -C $(top_builddir)/support/gc
 
 # Compiling and installing everything and runing test
 # ---------------------------------------------------
 install: all installdirs
-       $(INSTALL) $(TARGET) `echo $(bindir)/sdcc$(EXEEXT)|sed '$(transform)'`
-       $(STRIP) `echo $(bindir)/sdcc$(EXEEXT)|sed '$(transform)'`
+       $(INSTALL) $(TARGET) `echo $(DESTDIR)$(bindir)/sdcc$(EXEEXT)|sed '$(transform)'`
+       $(STRIP) `echo $(DESTDIR)$(bindir)/sdcc$(EXEEXT)|sed '$(transform)'`
 
 
 # Deleting all the installed files
 # --------------------------------
 uninstall:
-       rm -f $(bindir)/sdcc$(EXEEXT)
+       rm -f $(DESTDIR)$(bindir)/sdcc$(EXEEXT)
 
 # Performing self-test
 # --------------------
@@ -79,18 +84,22 @@ installcheck:
 # Creating installation directories
 # ---------------------------------
 installdirs:
-       $(INSTALL) -d $(bindir)
+       $(INSTALL) -d $(DESTDIR)$(bindir)
 
 
 # Creating dependencies
 # ---------------------
-dep: Makefile.dep
+dep: version.h Makefile.dep
 
-Makefile.dep: $(SOURCES) $(SLIBSOURCES) $(SPECIAL) *.h $(PRJDIR)/*.h
-       $(CPP) $(CPPFLAGS) $(M_OR_MM) $(SOURCES) $(SLIBSOURCES) >Makefile.dep
+Makefile.dep: version.h $(SOURCES) $(SLIBSOURCES) $(SPECIAL)
+       $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) >Makefile.dep
 
-include Makefile.dep
-include clean.mk
+# don't include Makefile.dep for the listed targets:
+ifeq "$(findstring $(MAKECMDGOALS),uninstall check installcheck installdirs checkconf \
+                                   clean distclean mostlyclean realclean)" ""
+  -include Makefile.dep
+endif
+include $(srcdir)/clean.mk
 
 
 # My rules
@@ -117,6 +126,9 @@ SDCCy.c: SDCC.y
 SDCClex.c: SDCC.lex SDCCy.h
        $(LEX) -t $< >$@
 
+version.h: ../ChangeLog
+       $(AWK) -f $(srcdir)/version.awk $< > $@
+
 .y.c:
        rm -f $*.cc $*.h
        $(YACC) -d $<
@@ -131,8 +143,8 @@ SDCClex.c: SDCC.lex SDCCy.h
 # Remaking configuration
 # ----------------------
 checkconf:
-       @if [ -f $(PRJDIR)/devel ]; then\
-         $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
+       @if [ -f $(top_builddir)/devel ]; then\
+         $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" \
          freshconf;\
        fi