moved mcs51 linker to as/link/mcs51
[fw/sdcc] / as / mcs51 / Makefile.in
index 54c13efd54a8b8b533e62e4b13a04e0eaf8051ea..42e5f995e4cdc726fb78ee8fe32ddd64f33fc2b9 100644 (file)
@@ -13,7 +13,8 @@ CPP           = @CPP@
 INSTALL                = @INSTALL@
 STRIP           = @STRIP@
 
-PRJDIR         = ../..
+top_builddir   = @top_builddir@
+top_srcdir     = @top_srcdir@
 
 srcdir         = @srcdir@
 prefix         = @prefix@
@@ -29,7 +30,9 @@ infodir         = @info@
 
 EXEEXT          = @EXEEXT@
 
-CPPFLAGS       = @CPPFLAGS@ -I. -I$(PRJDIR)
+VPATH           = @srcdir@
+
+CPPFLAGS       = @CPPFLAGS@ -I. -I$(srcdir)
 CFLAGS         = @CFLAGS@ -Wall -DINDEXLIB
 M_OR_MM                = @M_OR_MM@
 LDFLAGS                = @LDFLAGS@
@@ -39,39 +42,27 @@ ASOBJECTS   = asmain.o aslex.o assym.o assubr.o asnoice.o \
                  i51ext.o i51pst.o i51mch.o i51adr.o strcmpi.o
 ASSOURCES      = $(patsubst %.o,%.c,$(ASOBJECTS))
 
-LKOBJECTS      = lkmain.o lkhead.o lkarea.o lkdata.o \
-                 lkeval.o lklex.o lksym.o lkrloc.o \
-                 lklibr.o lklist.o lkihx.o lks19.o \
-                 lkstore.o lknoice.o lkmem.o lkaomf51.o strcmpi.o
-LKSOURCES      = $(patsubst %.o,%.c,$(LKOBJECTS))
-
-ASX8051                = $(PRJDIR)/bin/asx8051$(EXEEXT)
-ASLINK         = $(PRJDIR)/bin/aslink$(EXEEXT)
+ASX8051                = $(top_builddir)bin/asx8051$(EXEEXT)
 
 transform       = @program_transform_name@
 
 # Compiling entire program or any subproject
 # ------------------------------------------
-all: checkconf $(ASX8051) $(ASLINK)
+all: checkconf $(ASX8051)
 
 $(ASX8051): $(ASOBJECTS)
-       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(ASOBJECTS) 
-
-$(ASLINK): $(LKOBJECTS)
-       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(LKOBJECTS)
+       $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(ASOBJECTS)
 
-# Compiling and installing everything and runing test
-# ---------------------------------------------------
+# Compiling and installing everything and running test
+# ----------------------------------------------------
 install: all installdirs
-       $(INSTALL) $(ASX8051) `echo $(bindir)/asx8051$(EXEEXT)|sed '$(transform)'`
-       $(STRIP) `echo $(bindir)/asx8051$(EXEEXT)|sed '$(transform)'`
-       $(INSTALL) $(ASLINK) `echo $(bindir)/aslink$(EXEEXT)|sed '$(transform)'`
-       $(STRIP) `echo $(bindir)/aslink$(EXEEXT)|sed '$(transform)'`
+       $(INSTALL) $(ASX8051) `echo $(DESTDIR)$(bindir)/asx8051$(EXEEXT)|sed '$(transform)'`
+       $(STRIP) `echo $(DESTDIR)$(bindir)/asx8051$(EXEEXT)|sed '$(transform)'`
 
 # Deleting all the installed files
 # --------------------------------
 uninstall:
-       rm -f $(bindir)/asx8051$(EXEEXT) $(bindir)/aslink$(EXEEXT)
+       rm -f $(DESTDIR)$(bindir)/asx8051$(EXEEXT)
 
 
 # Performing self-test
@@ -87,18 +78,21 @@ installcheck:
 # 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) $(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
 # --------
@@ -109,8 +103,8 @@ include clean.mk
 # 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