X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fport.mk;h=8da5214b70319dc02dc74ab2544a2023269b15c0;hb=80972b2e54c9b88f11c27b878874fd2a6a681391;hp=9df7548e83c330c087eea5c0288895a6d6ee3bcf;hpb=dc1495e26bde46b7ba0c4b83ffd1cb6bdeab4dea;p=fw%2Fsdcc diff --git a/src/port.mk b/src/port.mk index 9df7548e..8da5214b 100644 --- a/src/port.mk +++ b/src/port.mk @@ -5,20 +5,20 @@ # PREBUILD - list of special files to build before deps. # Ports are always located in sdcc/src/ -PRJDIR = ../.. + # Output LIB = port.a # Include the sdcc/src directory -INCLUDEFLAGS = -I.. +INCLUDEFLAGS = -I$(srcdir)/.. -I.. # If the sources aren't specified, assume all in this directory. ifndef SOURCES -SOURCES = $(wildcard *.c) +SOURCES = $(notdir $(wildcard $(srcdir)/*.c)) endif # If the peephole rules aren't specified, assume all. ifndef PEEPRULES -PEEPDEFS = $(wildcard *.def) +PEEPDEFS = $(notdir $(wildcard $(srcdir)/*.def)) PEEPRULES = $(PEEPDEFS:.def=.rul) endif @@ -26,22 +26,24 @@ PREBUILD += $(PEEPRULES) all: $(PREBUILD) dep $(LIB) -include $(PRJDIR)/Makefile.common +include $(top_builddir)/Makefile.common $(LIB): $(OBJ) rm -f $(LIB) - ar r $(LIB) $(OBJ) + $(AR) r $(LIB) $(OBJ) $(RANLIB) $(LIB) %.rul: %.def - $(AWK) -f ../SDCCpeeph.awk $< > $@ + $(AWK) -f $(srcdir)/../SDCCpeeph.awk $< > $@ dep: Makefile.dep -Makefile.dep: $(PREBUILD) Makefile $(SOURCES) $(SPECIAL) *.h $(PRJDIR)/*.h $(PRJDIR)/src/*.h - $(CPP) $(CPPFLAGS) $(M_OR_MM) $(SOURCES) >Makefile.dep +Makefile.dep: $(PREBUILD) Makefile $(SOURCES) $(SPECIAL) + $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) >Makefile.dep -include Makefile.dep +# don't include Makefile.dep for the listed targets: +ifeq "$(findstring $(MAKECMDGOALS),clean distclean)" "" + -include Makefile.dep +endif -clean: - rm -f $(LIB) *.o *~ port.a $(CLEANSPEC) +include $(srcdir)/../port-clean.mk