-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support "make install"
- Loading branch information
Showing
2 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# We don't want to touch the installed files, if the file content | ||
# wasn't changed. ´install -C´ is not sufficcient, because | ||
# it touches the destination files even if they are not copied. | ||
# | ||
# If we did an install based on 'cmp' in the Makefile, the Makefile | ||
# would get quite bloated. So instead we just call an install script. | ||
# | ||
# GNU default for prefix is /usr/local but we want to put some tools | ||
# into /, some into /usr and some into /usr/local. | ||
# | ||
# This repository is not expected to be portable. So we take the | ||
# freedom to set the default prefix to empty and interpret this to | ||
# use different prefixes for individual tools. If prefix is overwritten | ||
# in the command line, all tools will go into the same tree. Alternativly, | ||
# root_prefix, usr_prefix and usrlocal_prefix may be overwritten on | ||
# the command line to individual values. | ||
# | ||
# | ||
# We honor the following conventional make variables | ||
# and pass them via environment to the install script: | ||
# prefix | ||
# root_prefix use_prefix usrlocal_prefix | ||
# root_exec_prefix root_bindir root_sbindir | ||
# usr_exec_prefix usr_bindir usr_sbindir | ||
# usrlocal_exec_prefix usrlocal_bindir usrlocal_sbindir | ||
# sysconfdir systemdunitdir | ||
# srcdir | ||
# INSTALL INSTALL_PROGRAM INSTALL_DATA | ||
# DESTDIR | ||
|
||
prefix= | ||
ifeq "$(prefix)" "" | ||
root_prefix= | ||
usr_prefix=/usr | ||
usrlocal_prefix=/usr/local | ||
else | ||
root_prefix=$(prefix) | ||
usr_prefix=$(prefix) | ||
usrlocal_prefix=$(prefix) | ||
endif | ||
|
||
root_exec_prefix=$(root_prefix) | ||
root_bindir=$(root_exec_prefix)/bin | ||
root_sbindir=$(root_exec_prefix)/sbin | ||
|
||
usr_exec_prefix=$(usr_prefix) | ||
usr_bindir=$(usr_exec_prefix)/bin | ||
usr_sbindir=$(usr_exec_prefix)/sbin | ||
|
||
usrlocal_exec_prefix=$(usrlocal_prefix) | ||
usrlocal_bindir=$(usrlocal_exec_prefix)/bin | ||
usrlocal_sbindir=$(usrlocal_exec_prefix)/sbin | ||
|
||
sysconfdir=$(prefix)/etc | ||
systemdunitdir=$(sysconfdir)/systemd/system | ||
|
||
srcdir=. | ||
|
||
INSTALL=install -v | ||
INSTALL_PROGRAM = $(INSTALL) | ||
INSTALL_DATA = $(INSTALL) -m 644 | ||
|
||
all: | ||
@echo 'Nothing to be done. Ready for "make install"' | ||
|
||
install: | ||
@prefix="$(prefix)" usr_prefix="$(usr_prefix)" usrlocal_prefix="$(usrlocal_prefix)" \ | ||
root_exec_prefix="$(root_exec_prefix)" root_bindir="$(root_bindir)" root_sbindir="$(root_sbindir)" \ | ||
usr_exec_prefix="$(usr_exec_prefix)" use_bindir="$(usr_bindir)" usr_sbindir="$(usr_sbindir)" \ | ||
usrlocal_exec_prefix="$(usrlocal_exec_prefix)" use_bindir="$(usrlocal_bindir)" usrlocal_sbindir="$(usrlocal_sbindir)" \ | ||
srcdir="$(srcdir)" \ | ||
INSTALL="$(INSTALL)" INSTALL_PROGRAM="$(INSTALL_PROGRAM)" INSTALL_DATA="$(INSTALL_DATA)" \ | ||
DESTDIR="$(DESTDIR)" \ | ||
./install.sh | ||
|
||
.PHONY: all install | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#! /bin/sh | ||
|
||
# Although these should be inherited from the Makefile, | ||
# we set some defaults ourself, too, in case we are called | ||
# not from make but standalone. | ||
|
||
if [ -z "$prefix" ]; then | ||
: ${root_prefix:=} | ||
: ${usr_prefix:=/usr} | ||
: ${usrlocal_prefix:=/usr/local} | ||
else | ||
: ${root_prefix:=$prefix} | ||
: ${usr_prefix:=$prefix} | ||
: ${usrlocal_prefix:=$prefix} | ||
fi | ||
|
||
: ${root_exec_prefix:=$root_prefix} | ||
: ${root_bindir:=$root_exec_prefix/bin} | ||
: ${root_sbindir:=$root_exec_prefix/sbin} | ||
|
||
: ${usr_exec_prefix:=$usr_prefix} | ||
: ${usr_bindir:=$usr_exec_prefix/bin} | ||
: ${usr_sbindir:=$usr_exec_prefix/sbin} | ||
|
||
: ${usrlocal_exec_prefix:=$usrlocal_prefix} | ||
: ${usrlocal_bindir:=$usrlocal_exec_prefix/bin} | ||
: ${usrlocal_sbindir:=$usrlocal_exec_prefix/sbin} | ||
|
||
: ${sysconfdir:=$prefix/etc} | ||
: ${systemdunitdir:=$sysconfdir/systemd/system} | ||
|
||
: ${INSTALL:=install -v} | ||
: ${INSTALL_PROGRAM:=$INSTALL} | ||
: ${INSTALL_DATA:=$INSTALL -m 644} | ||
|
||
function need_update() | ||
{ | ||
local src="$1" | ||
local dst="$2" | ||
|
||
test -e "$dst" || return 0 | ||
test "$(stat -c%s "$src")" = "$(stat -c%s "$dst")" || return 0 | ||
cmp -s "$src" "$dst" || return 0 | ||
return 1 | ||
} | ||
|
||
function install_if() | ||
{ | ||
local src="$1" | ||
local dst="$2" | ||
shift 2 | ||
|
||
if need_update "$src" "$dst"; then | ||
"$@" "$src" "$dst" | ||
fi | ||
return 0 | ||
} | ||
|
||
function install_exec() | ||
{ | ||
install_if "$1" "$2" $INSTALL_PROGRAM | ||
} | ||
|
||
function install_data() | ||
{ | ||
install_if "$1" "$2" $INSTALL_DATA | ||
} | ||
|
||
umask 022; | ||
|
||
mkdir -p "$DESTDIR$usr_bindir" | ||
mkdir -p "$DESTDIR$usr_sbindir" | ||
mkdir -p "$DESTDIR$systemdunitdir" | ||
mkdir -p "$DESTDIR$usrlocal_bindir" | ||
|
||
install_exec make-automaps/make-automaps "$DESTDIR$usr_sbindir/make-automaps" | ||
install_data misc_systemd_units/automount.service "$DESTDIR$systemdunitdir/automount.service" | ||
install_data misc_systemd_units/gdm.service "$DESTDIR$systemdunitdir/gdm.service" | ||
install_exec mxgrub/mxgrub "$DESTDIR$usr_sbindir/mxgrub" | ||
install_exec mxnetctl/mxnetctl "$DESTDIR$usr_sbindir/mxnetctl" | ||
install_exec mxrouter/mxrouterctl "$DESTDIR$usr_sbindir/mxrouterctl" | ||
install_exec mxvlan/mxvlanctl "$DESTDIR$usr_sbindir/mxvlanctl" | ||
install_exec netlog/netlog "$DESTDIR$usr_sbindir/netlog" | ||
install_data netlog/netlog.service "$DESTDIR$systemdunitdir/netlog.service" | ||
install_exec nvidiactl/nvidiactl "$DESTDIR$usr_sbindir/nvidiactl" | ||
install_data nvidiactl/nvidia.service "$DESTDIR$systemdunitdir/nvidia.service" | ||
install_exec pdist/pdist "$DESTDIR$usrlocal_bindir/pdist" | ||
install_exec pmirror/pmirror "$DESTDIR$usrlocal_bindir/pmirror" | ||
install_exec prun/prun "$DESTDIR$usr_bindir/prun" | ||
install_exec put_websafe/put_websafe "$DESTDIR$usrlocal_bindir/put_websafe" | ||
|
||
exit |