Skip to content

Commit

Permalink
Replace prefix at install time for 'make install prefix=/new/path' (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
benkirk committed Jan 24, 2013
1 parent 43fc5f5 commit 8057190
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
20 changes: 18 additions & 2 deletions Makefile.am
Expand Up @@ -82,9 +82,25 @@ EXTRA_DIST += contrib/bin/make_dependencies.pl
libmesh_configdir = $(exec_prefix)/bin
libmesh_config_SCRIPTS = contrib/bin/libmesh-config

# when doing 'make install', symlik etc/libmesh/Make.common
# when doing 'make install', update libmesh_config
# This rule extends the built-in make install rule, and can
# be used to:
# when doing 'make install prefix=/other/path', update generated files
# when doing 'make install', symlik etc/libmesh/Make.common
# when doing 'make install', update libmesh_config
install-data-hook:
@if (test "x$(prefix)" != "x@prefix@") ; then \
oldprefix="@prefix@" ; \
newprefix="$(prefix)" ; \
for genfile in `find $(DESTDIR)$(prefix) -name "*.pc" -o -name Make.common -o -name libmesh-config -type f` ; do \
echo " " ; \
echo " *** replacing $$oldprefix" ; \
echo " *** with $$newprefix" ; \
echo " *** in generated file $$genfile" ; \
echo " " ; \
cd $(DESTDIR)$(prefix) && cat $$genfile | $(SED) "s,$$oldprefix,$$newprefix,g" > $$genfile.replaced ; \
cd $(DESTDIR)$(prefix) && mv $$genfile.replaced $$genfile ; \
done ; \
fi
cd $(DESTDIR)$(prefix) && rm -f Make.common && $(LN_S) etc/libmesh/Make.common Make.common
cat $(DESTDIR)$(libmesh_configdir)/libmesh-config | $(SED) "s/has_been_installed=no/has_been_installed=yes/g" > $(DESTDIR)$(libmesh_configdir)/libmesh-config.installed
mv $(DESTDIR)$(libmesh_configdir)/libmesh-config.installed $(DESTDIR)$(libmesh_configdir)/libmesh-config && chmod +x $(DESTDIR)$(libmesh_configdir)/libmesh-config
Expand Down
20 changes: 18 additions & 2 deletions Makefile.in
Expand Up @@ -26420,9 +26420,25 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
uninstall-nobase_dataDATA uninstall-pkgconfigDATA


# when doing 'make install', symlik etc/libmesh/Make.common
# when doing 'make install', update libmesh_config
# This rule extends the built-in make install rule, and can
# be used to:
# when doing 'make install prefix=/other/path', update generated files
# when doing 'make install', symlik etc/libmesh/Make.common
# when doing 'make install', update libmesh_config
install-data-hook:
@if (test "x$(prefix)" != "x@prefix@") ; then \
oldprefix="@prefix@" ; \
newprefix="$(prefix)" ; \
for genfile in `find $(DESTDIR)$(prefix) -name "*.pc" -o -name Make.common -o -name libmesh-config -type f` ; do \
echo " " ; \
echo " *** replacing $$oldprefix" ; \
echo " *** with $$newprefix" ; \
echo " *** in generated file $$genfile" ; \
echo " " ; \
cd $(DESTDIR)$(prefix) && cat $$genfile | $(SED) "s,$$oldprefix,$$newprefix,g" > $$genfile.replaced ; \
cd $(DESTDIR)$(prefix) && mv $$genfile.replaced $$genfile ; \
done ; \
fi
cd $(DESTDIR)$(prefix) && rm -f Make.common && $(LN_S) etc/libmesh/Make.common Make.common
cat $(DESTDIR)$(libmesh_configdir)/libmesh-config | $(SED) "s/has_been_installed=no/has_been_installed=yes/g" > $(DESTDIR)$(libmesh_configdir)/libmesh-config.installed
mv $(DESTDIR)$(libmesh_configdir)/libmesh-config.installed $(DESTDIR)$(libmesh_configdir)/libmesh-config && chmod +x $(DESTDIR)$(libmesh_configdir)/libmesh-config
Expand Down

0 comments on commit 8057190

Please sign in to comment.