[1/3] sim: build: move install steps to the top-level
Commit Message
We still have to maintain custom install rules due to how we rename
arch-specific files with an arch prefix in their name, but we can at
least unify the logic in the common dir.
---
sim/Makefile.am | 27 +++++++++
sim/Makefile.in | 113 ++++++++++++++++++++++++--------------
sim/README-HACKING | 2 -
sim/common/Make-common.in | 19 +------
sim/erc32/Makefile.in | 6 --
sim/erc32/local.mk | 6 ++
sim/ppc/Makefile.in | 15 +----
7 files changed, 107 insertions(+), 81 deletions(-)
@@ -59,6 +59,10 @@ LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
## Deps to add to the all-recursive target. These are built before descending
## into any subdirs.
SIM_ALL_RECURSIVE_DEPS =
+## Deps to add to the install-data-local target.
+SIM_INSTALL_DATA_LOCAL_DEPS =
+## Deps to add to the install-exec-local target.
+SIM_INSTALL_EXEC_LOCAL_DEPS =
# Generate target constants for newlib/libgloss from its source tree.
# This file is shipped with distributions so we build in the source dir.
@@ -138,3 +142,26 @@ include v850/local.mk
endif
all-recursive: $(SIM_ALL_RECURSIVE_DEPS)
+
+install-data-local: installdirs $(SIM_INSTALL_DATA_LOCAL_DEPS)
+ $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(libdir)
+ lib=`echo sim | sed '$(program_transform_name)'`; \
+ for d in $(SUBDIRS); do \
+ if [ -e $$d/run$(EXEEXT) ]; then \
+ n="$$lib"; \
+ [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
+ n="lib$$n.a"; \
+ $(INSTALL_DATA) $$d/libsim.a $(DESTDIR)$(libdir)/$$n || exit 1; \
+ fi; \
+ done
+
+install-exec-local: installdirs $(SIM_INSTALL_EXEC_LOCAL_DEPS)
+ $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
+ run=`echo run | sed '$(program_transform_name)'`; \
+ for d in $(SUBDIRS); do \
+ if [ -e $$d/run$(EXEEXT) ]; then \
+ n="$$run"; \
+ [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
+ $(INSTALL_PROGRAM) $$d/run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) || exit 1; \
+ fi; \
+ done
@@ -71,8 +71,6 @@ SIM_EXTRA_DEPS =
SIM_EXTRA_CFLAGS =
# List of extra libraries to link with.
SIM_EXTRA_LIBS =
-# Dependency of `install' to install any extra files.
-SIM_EXTRA_INSTALL =
# Dependency of `clean' to clean any extra files.
SIM_EXTRA_CLEAN =
@@ -115,8 +115,6 @@ SIM_EXTRA_CFLAGS =
SIM_EXTRA_LIBS =
# List of main object files for `run'.
SIM_RUN_OBJS = nrun.o
-# Dependency of `install' to install any extra files.
-SIM_EXTRA_INSTALL =
# Dependency of `clean' to clean any extra files.
SIM_EXTRA_CLEAN =
# Likewise `distclean'
@@ -322,23 +320,8 @@ stamp-modules: Makefile $(SIM_OBJS:.o=.c)
# Support targets.
-install: install-common $(SIM_EXTRA_INSTALL)
-
-install-common: installdirs
- a=`basename "$$(pwd)"`; \
- n=`echo run | sed '$(program_transform_name)'`; \
- [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
- $(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
- n=`echo sim | sed '$(program_transform_name)'`; \
- a=`basename "$$(pwd)"`; \
- [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
- n="lib$$n.a"; \
- $(INSTALL_DATA) libsim.a $(DESTDIR)$(libdir)/$$n ; \
- ( cd $(DESTDIR)$(libdir) ; $(RANLIB) $$n )
-
+install:
installdirs:
- $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir)
- $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir)
check:
@@ -24,7 +24,6 @@ SIM_OBJS = exec.o erc32.o func.o help.o float.o interf.o
SIM_RUN_OBJS = sis.o
SIM_EXTRA_CFLAGS = $(READLINE_CFLAGS)
SIM_EXTRA_LIBS = $(READLINE_LIB) $(TERMCAP_LIB)
-SIM_EXTRA_INSTALL = install-sis
SIM_EXTRA_CLEAN = clean-sis
# UARTS run at about 115200 baud (simulator time). Add -DFAST_UART to
@@ -39,10 +38,5 @@ sis$(EXEEXT): run$(EXEEXT)
$(SILENCE) rm -f $@
$(ECHO_GEN) ln $< $@ 2>/dev/null || $(LN_S) $< $@ 2>/dev/null || cp -p $< $@
-# Copy the files into directories where they will be run.
-install-sis: installdirs
- n=`echo sis | sed '$(program_transform_name)'`; \
- $(INSTALL_PROGRAM) sis$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
-
clean-sis:
rm -f sis
@@ -17,3 +17,9 @@
%C%docdir = $(docdir)/%C%
%C%doc_DATA = %D%/README.erc32 %D%/README.gdb %D%/README.sis
+
+SIM_INSTALL_EXEC_LOCAL_DEPS += sim-%D-install-exec-local
+sim-%D-install-exec-local: installdirs
+ $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
+ n=`echo sis | sed '$(program_transform_name)'`; \
+ $(INSTALL_PROGRAM) %D%/sis$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
@@ -843,18 +843,5 @@ pdf:
clean-pdf:
install-pdf:
-install: installdirs
- a=`basename "$$(pwd)"`; \
- n=`echo run | sed '$(program_transform_name)'`; \
- [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
- $(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
-
-install-strip: installdirs
- a=`basename "$$(pwd)"`; \
- n=`echo run | sed '$(program_transform_name)'`; \
- [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
- $(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
- $(STRIP) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
-
+install:
installdirs:
- $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir)