INSTALL = @INSTALL@
STRIP = @STRIP@
-PRJDIR = ../..
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
srcdir = @srcdir@
prefix = @prefix@
EXEEXT = @EXEEXT@
-CPPFLAGS = @CPPFLAGS@ -I. -I$(PRJDIR)
+VPATH = @srcdir@
+
+CPPFLAGS = @CPPFLAGS@ -I. -I$(srcdir)
CFLAGS = @CFLAGS@ -Wall
M_OR_MM = @M_OR_MM@
LDFLAGS = @LDFLAGS@
lkstore.o lknoice.o lkmem.o lkaomf51.o strcmpi.o
LKSOURCES = $(patsubst %.o,%.c,$(LKOBJECTS))
-ASHC08 = $(PRJDIR)/bin/as-hc08$(EXEEXT)
-ASLINK = $(PRJDIR)/bin/link-hc08$(EXEEXT)
+ASHC08 = $(top_builddir)bin/as-hc08$(EXEEXT)
+ASLINK = $(top_builddir)bin/link-hc08$(EXEEXT)
transform = @program_transform_name@
# Compiling and installing everything and runing test
# ---------------------------------------------------
install: all installdirs
- $(INSTALL) $(ASHC08) `echo $(bindir)/as-hc08$(EXEEXT)|sed '$(transform)'`
- $(STRIP) `echo $(bindir)/as-hc08$(EXEEXT)|sed '$(transform)'`
- $(INSTALL) $(ASLINK) `echo $(bindir)/link-hc08$(EXEEXT)|sed '$(transform)'`
- $(STRIP) `echo $(bindir)/link-hc08$(EXEEXT)|sed '$(transform)'`
+ $(INSTALL) $(ASHC08) `echo $(DESTDIR)$(bindir)/as-hc08$(EXEEXT)|sed '$(transform)'`
+ $(STRIP) `echo $(DESTDIR)$(bindir)/as-hc08$(EXEEXT)|sed '$(transform)'`
+ $(INSTALL) $(ASLINK) `echo $(DESTDIR)$(bindir)/link-hc08$(EXEEXT)|sed '$(transform)'`
+ $(STRIP) `echo $(DESTDIR)$(bindir)/link-hc08$(EXEEXT)|sed '$(transform)'`
# Deleting all the installed files
# --------------------------------
uninstall:
- rm -f $(bindir)/as-hc08$(EXEEXT) $(bindir)/link-hc08$(EXEEXT)
+ rm -f $(DESTDIR)$(bindir)/as-hc08$(EXEEXT) $(DESTDIR)$(bindir)/link-hc08$(EXEEXT)
# Performing self-test
# Creating installation directories
# ---------------------------------
installdirs:
- $(INSTALL) -d $(bindir)
+ $(INSTALL) -d $(DESTDIR)$(bindir)
# Creating dependencies
# ---------------------
dep: Makefile.dep
-Makefile.dep: $(ASSOURCES) $(LKSOURCES) *.h $(PRJDIR)/*.h
- $(CPP) $(CPPFLAGS) $(M_OR_MM) $(ASSOURCES) $(LKSOURCES) >Makefile.dep
+Makefile.dep: $(ASSOURCES) $(LKSOURCES) $(srcdir)/*.h $(top_builddir)*.h $(top_srcdir)/*.h
+ $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) >Makefile.dep
-include Makefile.dep
-include clean.mk
+ifeq "$(findstring $(MAKECMDGOALS),uninstall check installcheck installdirs \
+ clean distclean mostlyclean realclean)" ""
+ include Makefile.dep
+endif
+include $(srcdir)/clean.mk
# My rules
# --------
# Remaking configuration
# ----------------------
checkconf:
- @if [ -f $(PRJDIR)/devel ]; then\
- $(MAKE) -f conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" freshconf;\
+ @if [ -f $(top_builddir)devel ]; then\
+ $(MAKE) -f conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" freshconf;\
fi
# End of Makefile