Makefile
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 01 Jan 2024 20:53:49 +0200
changeset 1039 78cdb4a057e3
parent 1032 9cf008356bdf
permissions -rw-r--r--
Create symlink from ~/.bash_profile for login shell to activate my ~/.bashrc.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 601
diff changeset
     1
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 601
diff changeset
     2
################################################################
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 601
diff changeset
     3
# Standard GNU Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 601
diff changeset
     4
957
b491e9c375e7 Execute Make recipes by Bash.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
     5
SHELL = /bin/bash
b491e9c375e7 Execute Make recipes by Bash.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 952
diff changeset
     6
.SHELLFLAGS = -xeuc
165
517623c39dac Add work-around for PATH. Under Windows find.exe going in collision with
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 147
diff changeset
     7
export PATH := /bin:/usr/bin:${PATH}
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
166
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
     9
# Disable built in pattern rules.
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    10
MAKEFLAGS += -r
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    11
# Disable built in variables.
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    12
MAKEFLAGS += -R
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    13
# Disable built in suffix rules.
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    14
.SUFFIXES:
602
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 601
diff changeset
    15
# Delete target file if command fails.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 601
diff changeset
    16
.DELETE_ON_ERROR:
166
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    17
# Default target.
217
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
    18
.DEFAULT_GOAL = help
166
27fc63b27dad Add default Makefile settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 165
diff changeset
    19
249
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    20
################################################################
914
0dba496629c9 Allow to override font size by local settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
    21
# Config.
0dba496629c9 Allow to override font size by local settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
    22
0dba496629c9 Allow to override font size by local settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
    23
CFG_FILE := Makefile.cfg
0dba496629c9 Allow to override font size by local settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
    24
include $(CFG_FILE)
0dba496629c9 Allow to override font size by local settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
    25
0dba496629c9 Allow to override font size by local settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
    26
# Override defaults.
0dba496629c9 Allow to override font size by local settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
    27
CFG_LOCAL_FILE := Makefile.cfg.override
0dba496629c9 Allow to override font size by local settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
    28
-include $(CFG_LOCAL_FILE)
0dba496629c9 Allow to override font size by local settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
    29
0dba496629c9 Allow to override font size by local settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
    30
################################################################
249
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    31
# Platform definition.
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
    32
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
ifeq '' '$(HOME)'
12
52322e5cc6bb Proper determine Windows.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 2
diff changeset
    34
  $(error HOME env var not set!)
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
endif
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    36
801
2657c198b9e2 Fix: GNU 'install' utility is not compatible with Solaris version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 790
diff changeset
    37
uname-s := $(shell uname -s)
2657c198b9e2 Fix: GNU 'install' utility is not compatible with Solaris version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 790
diff changeset
    38
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    39
host_os = linux
801
2657c198b9e2 Fix: GNU 'install' utility is not compatible with Solaris version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 790
diff changeset
    40
ifneq '' '$(filter CYGWIN%,$(uname-s))'
249
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    41
  host_os = cygwin
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    42
endif
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    43
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    44
################################################################
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    45
# Build tool definition/switches.
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    46
910
60635dc58066 Create missing directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 905
diff changeset
    47
INSTALL_DATA := install -m 640 -D
801
2657c198b9e2 Fix: GNU 'install' utility is not compatible with Solaris version.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 790
diff changeset
    48
249
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    49
RST2HTML = rst2html
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    50
ifeq '$(host_os)' 'cygwin'
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    51
  RST2HTML = rst2html.py
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    52
endif
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    53
218
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
    54
################################################################
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
    55
# Project dirs/files.
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
    56
427
59627b533219 Merge ".fvwm" project into "skel" project.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 329
diff changeset
    57
OVERRIDDEN_ITEMS := \
966
fdb61fbcca35 No need special steps for .local/share/applications/mimeapps.list
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 965
diff changeset
    58
    .local/share/applications/mimeapps.list \
964
e0451bc7141f Do not install fvwm configs if it is not available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 963
diff changeset
    59
    .xxkbrc .xmodmaprc .stalonetrayrc \
952
04e8208374bd Added Shift+Tab for session switching in GNU Screen & tmux.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    60
    .inputrc .Xdefaults .xinitrc .xserverrc \
04e8208374bd Added Shift+Tab for session switching in GNU Screen & tmux.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 928
diff changeset
    61
    .screenrc .tmux.conf \
886
74f10c613c59 Added colors definition for cdiff because default schema uses blue for added
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 817
diff changeset
    62
    .dircolors .colordiffrc \
1032
9cf008356bdf Dynamically build completion for podman.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1031
diff changeset
    63
  .bashrc .env.bash .bash_completion .bash_completion.d .local/share/bash-completion/completions .zshrc \
977
0b4affe58cff Renamed .env => .bash.env to free .env name for user customization (famous dotenv file).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 969
diff changeset
    64
  .vimrc .ssh \
1016
8ba787ff5ab8 Removed .npmrc, HOME in Cygwin & running npm outside of Cygwin results in duplicating cache (in Cygwin HOME & in APPDATA).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 995
diff changeset
    65
    .pylintrc .pystartup .tclshrc .guile \
887
de60305d351e Do not override ~/.gradle/init.d/mavenLocal.gradle
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 886
diff changeset
    66
    .gradle/init.d/springColorLogging.gradle \
928
2b706bde17c2 Enable switching to wide line format of SQL output when necessary by psql.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 918
diff changeset
    67
    .sqshrc .psqlrc \
234
420c06da8fd1 Fix mail signature file name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 229
diff changeset
    68
    .signature .muttrc .tidy \
188
ff31eb2242c9 Add '.dictrc'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 173
diff changeset
    69
    .dictrc \
1024
ad0d69732368 Extracted username from .gitconfig to allow non-specific user install.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1016
diff changeset
    70
    .hgrc .hgignore .hgstyle .bazaar .gitignore .cvsrc .quiltrc .quiltrc-dpkg \
293
a9ac4e2551a0 Add '.glhackrc'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 292
diff changeset
    71
    .gnupg \
616
e3dd5c39cceb Colorizer for java logs...
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 611
diff changeset
    72
    .ackrc .grc \
790
aab9b6f83061 New mplayer2 uses old ~/.mplayer config directory for now.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 760
diff changeset
    73
    .mplayer \
293
a9ac4e2551a0 Add '.glhackrc'.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 292
diff changeset
    74
    .glhackrc
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
    75
MANUALINSTALL_ITEMS = .mc
117
02b91508db83 Add svn user config.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 116
diff changeset
    76
IFNONEXIST_ITEMS = .wgetrc .subversion
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
    77
249
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    78
RST_FILES = $(wildcard *.rst)
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    79
HTML_FILES = $(RST_FILES:.rst=.html)
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    80
1031
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
    81
# Might include my credentials.
918
0cba37c54a9e Added suffix mini to mini-tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 914
diff changeset
    82
TARBALL_MINI := skel-mini.tar.gz
1031
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
    83
# Without personal info.
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
    84
TARBALL_MICRO := skel-micro.tar.gz
904
87a79ec44985 Target to create tarball with essential files (to be moved to Vagrant box).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
    85
249
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    86
################################################################
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    87
# Build targets.
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    88
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    89
.PHONY: all
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    90
all:
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
    91
918
0cba37c54a9e Added suffix mini to mini-tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 914
diff changeset
    92
.PHONY: dist-mini
0cba37c54a9e Added suffix mini to mini-tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 914
diff changeset
    93
dist-mini: $(TARBALL_MINI)
904
87a79ec44985 Target to create tarball with essential files (to be moved to Vagrant box).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
    94
918
0cba37c54a9e Added suffix mini to mini-tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 914
diff changeset
    95
define TARBALL_MINI_DEPS
977
0b4affe58cff Renamed .env => .bash.env to free .env name for user customization (famous dotenv file).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 969
diff changeset
    96
.bashrc .env.bash .bash_completion \
904
87a79ec44985 Target to create tarball with essential files (to be moved to Vagrant box).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
    97
.inputrc .dircolors \
87a79ec44985 Target to create tarball with essential files (to be moved to Vagrant box).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
    98
.gitconfig .gitignore .hgrc .hgignore .hgstyle
87a79ec44985 Target to create tarball with essential files (to be moved to Vagrant box).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
    99
endef
87a79ec44985 Target to create tarball with essential files (to be moved to Vagrant box).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
   100
918
0cba37c54a9e Added suffix mini to mini-tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 914
diff changeset
   101
$(TARBALL_MINI): $(TARBALL_MINI_DEPS)
0cba37c54a9e Added suffix mini to mini-tarball.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 914
diff changeset
   102
	tar zcf $(TARBALL_MINI) $(TARBALL_MINI_DEPS)
904
87a79ec44985 Target to create tarball with essential files (to be moved to Vagrant box).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
   103
1031
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   104
.PHONY: dist-micro
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   105
dist-micro: $(TARBALL_MICRO)
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   106
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   107
define TARBALL_MICRO_DEPS
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   108
.bashrc .env.bash .bash_completion \
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   109
.gitconfig \
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   110
.inputrc .dircolors
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   111
endef
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   112
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   113
$(TARBALL_MICRO): $(TARBALL_MICRO_DEPS)
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   114
	tar zcf $(TARBALL_MICRO) $(TARBALL_MICRO_DEPS)
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   115
218
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   116
################################################################
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   117
# Install/uninstall targets.
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   118
1025
03c2b7f76bb7 Target to install only essential files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1024
diff changeset
   119
# Essential rc files.
03c2b7f76bb7 Target to install only essential files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1024
diff changeset
   120
.PHONY: install-mini
03c2b7f76bb7 Target to install only essential files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1024
diff changeset
   121
.ONESHELL:
03c2b7f76bb7 Target to install only essential files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1024
diff changeset
   122
install-mini:
03c2b7f76bb7 Target to install only essential files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1024
diff changeset
   123
	$(INSTALL_DATA) -t $(HOME) ${TARBALL_MINI_DEPS}
1039
78cdb4a057e3 Create symlink from ~/.bash_profile for login shell to activate my ~/.bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   124
	ln -s -f $(HOME)/.bashrc $(HOME)/.bash_profile
1025
03c2b7f76bb7 Target to install only essential files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1024
diff changeset
   125
1031
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   126
# Without personal info.
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   127
.PHONY: install-micro
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   128
.ONESHELL:
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   129
install-micro:
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   130
	$(INSTALL_DATA) -t $(HOME) ${TARBALL_MICRO_DEPS}
1039
78cdb4a057e3 Create symlink from ~/.bash_profile for login shell to activate my ~/.bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
   131
	ln -s -f $(HOME)/.bashrc $(HOME)/.bash_profile
1031
bfec97f86dc3 Added a target for TAR.GZ without personal info.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1026
diff changeset
   132
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
   133
.PHONY: install
960
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   134
.ONESHELL:
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   135
install:
961
d7b4c9d10b92 Collect and copy all files belonging to root of $HOME in one step. This speedups install in Cygwin: 7s => 5s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 960
diff changeset
   136
	declare -a files
960
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   137
	for item in $(OVERRIDDEN_ITEMS); do
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   138
		if [[ -f $$item ]]; then
1026
865f28fee788 Test pattern with the keyword "case".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
   139
			case "$$item" in
865f28fee788 Test pattern with the keyword "case".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
   140
				*/*) $(INSTALL_DATA) $$item $(HOME)/$$item ;;
865f28fee788 Test pattern with the keyword "case".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
   141
				*) files+=($$item) ;;
865f28fee788 Test pattern with the keyword "case".
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1025
diff changeset
   142
			esac
961
d7b4c9d10b92 Collect and copy all files belonging to root of $HOME in one step. This speedups install in Cygwin: 7s => 5s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 960
diff changeset
   143
		elif [[ -d $$item ]]; then
967
186bfef3c7d1 Replaced Bash "for" iteration with "find" utility.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 966
diff changeset
   144
			find $$item -type f -exec $(INSTALL_DATA) {} $(HOME)/{} ';'
960
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   145
		fi
2
48e601bfbca6 Split files depend of OS. New install algorithm.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 0
diff changeset
   146
	done
1024
ad0d69732368 Extracted username from .gitconfig to allow non-specific user install.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1016
diff changeset
   147
	cat .gitconfig .gitconfig.extra >$(HOME)/.gitconfig
961
d7b4c9d10b92 Collect and copy all files belonging to root of $HOME in one step. This speedups install in Cygwin: 7s => 5s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 960
diff changeset
   148
	$(INSTALL_DATA) -t $(HOME) "$${files[@]}"
969
cd71f361ae59 Replaced "~" with $(HOME).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 968
diff changeset
   149
	chmod 700 $(HOME)/.gnupg/
963
d008686721c6 Fixed install target: do not stop in the middle if fvwm is not here.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 962
diff changeset
   150
	if command -v fvwm; then
964
e0451bc7141f Do not install fvwm configs if it is not available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 963
diff changeset
   151
		cp -r .fvwm $(HOME)
969
cd71f361ae59 Replaced "~" with $(HOME).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 968
diff changeset
   152
		chmod a+x $(HOME)/.fvwm/FvwmKbdd.pl $(HOME)/.fvwm/xinit
963
d008686721c6 Fixed install target: do not stop in the middle if fvwm is not here.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 962
diff changeset
   153
		for f in /etc/xdg/menus/*.menu; do
d008686721c6 Fixed install target: do not stop in the middle if fvwm is not here.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 962
diff changeset
   154
			[[ -f "$$f" ]] || continue
d008686721c6 Fixed install target: do not stop in the middle if fvwm is not here.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 962
diff changeset
   155
			fname=$${f%.menu}
d008686721c6 Fixed install target: do not stop in the middle if fvwm is not here.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 962
diff changeset
   156
			fname=$${fname##*/}
969
cd71f361ae59 Replaced "~" with $(HOME).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 968
diff changeset
   157
			python .fvwm/xdg2fvwm.py Menu-$$fname $$f >$(HOME)/.fvwm/$$fname.hook
cd71f361ae59 Replaced "~" with $(HOME).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 968
diff changeset
   158
			echo "Read $$[HOME]/.fvwm/$$fname.hook" >>$(HOME)/.fvwm/config
cd71f361ae59 Replaced "~" with $(HOME).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 968
diff changeset
   159
			echo "AddToMenu MenuMyRoot $$fname Popup Menu-$$fname" >>$(HOME)/.fvwm/config
963
d008686721c6 Fixed install target: do not stop in the middle if fvwm is not here.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 962
diff changeset
   160
		done
d008686721c6 Fixed install target: do not stop in the middle if fvwm is not here.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 962
diff changeset
   161
	fi
969
cd71f361ae59 Replaced "~" with $(HOME).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 968
diff changeset
   162
	mkdir -p $(HOME)/.screenshot
960
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   163
	for item in $(IFNONEXIST_ITEMS); do
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   164
		if [[ -f $$item ]] && ! [[ -f $(HOME)/$$item ]]; then
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   165
			$(INSTALL_DATA) $$item $(HOME)/$$item
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   166
		fi
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   167
		if [[ -d $$item ]]; then
962
88a1ce08b362 No need for "mkdir", option "-D" of "install" takes care about missing directories.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 961
diff changeset
   168
			for file in `find $$item -type f`; do
960
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   169
				if [[ ! -f $(HOME)/$$file ]]; then
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   170
					$(INSTALL_DATA) $$file $(HOME)/$$file
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   171
				fi
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   172
			done
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   173
		fi
76
85dc8b07017a Allow installation of file which can be modified by user so you do not lose
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 75
diff changeset
   174
	done
969
cd71f361ae59 Replaced "~" with $(HOME).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 968
diff changeset
   175
	chmod a+x $(HOME)/.xinitrc $(HOME)/.xserverrc
cd71f361ae59 Replaced "~" with $(HOME).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 968
diff changeset
   176
	ln -s -f $(HOME)/.xinitrc $(HOME)/.xsession
968
dc543d247f29 Create symlink in a one step.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 967
diff changeset
   177
	ln -s -f $(HOME)/.bashrc $(HOME)/.bash_profile
960
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   178
	mkdir -p $(HOME)/.config/mc $(HOME)/.local/share/mc/
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   179
	umask 0117
994
247f27cfcf68 As of ~/.bashrc having space prefixed exclude pattern in HISTIGNORE no need for dedicated file, just add a symlink!
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 979
diff changeset
   180
	ln -s -f $(HOME)/.bashrc $(HOME)/.local/share/mc/bashrc
995
62df95ab609e Fix: there is no guaranty /etc/mc/mc.ext is in the system.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 994
diff changeset
   181
	[[ -f /etc/mc/mc.ext ]] \
62df95ab609e Fix: there is no guaranty /etc/mc/mc.ext is in the system.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 994
diff changeset
   182
		&& cat .config/mc/mc.ext /etc/mc/mc.ext > $(HOME)/.config/mc/mc.ext \
62df95ab609e Fix: there is no guaranty /etc/mc/mc.ext is in the system.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 994
diff changeset
   183
		|| $(INSTALL_DATA) .config/mc/mc.ext $(HOME)/.config/mc/mc.ext
802
d8ba282954cd Fix: Solaris 'file' utility does not support '--compile' option and user
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 801
diff changeset
   184
ifneq '' '$(filter $(host_os),cygwin linux)'
960
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   185
	if command -v file 1>/dev/null; then
965
136643324a32 Do not alter working directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 964
diff changeset
   186
		$(INSTALL_DATA) -t $(HOME) .magic
136643324a32 Do not alter working directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 964
diff changeset
   187
		( cd $(HOME); file --compile -m .magic )
295
7970a5d63d57 Add my magic file.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 293
diff changeset
   188
	fi
802
d8ba282954cd Fix: Solaris 'file' utility does not support '--compile' option and user
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 801
diff changeset
   189
endif
914
0dba496629c9 Allow to override font size by local settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 910
diff changeset
   190
	sed -e 's=@CFG_FONT_SIZE@=$(CFG_FONT_SIZE)=' <.minttyrc >$(HOME)/.minttyrc
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   191
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
   192
.PHONY: uninstall
960
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   193
.ONESHELL:
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   194
uninstall:
960
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   195
	for item in $(OVERRIDDEN_ITEMS); do
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   196
		if [ -f $$item ]; then
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   197
			[ -f $(HOME)/$$file ] && rm -f $(HOME)/$$item
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   198
		fi
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   199
		if [ -d $$item ]; then
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   200
			for file in `find $$item -depth`; do
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   201
				if [ -d $$file ]; then
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   202
					rmdir $(HOME)/$$file || :
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   203
					continue
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   204
				fi
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   205
				[ -f $(HOME)/$$file ] && rm $(HOME)/$$file
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   206
			done
b4b2d30f6c97 Increased "install" speed on Cygwin with ".ONESHELL" (by avoiding SHELL forks) 9s => 7s.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 959
diff changeset
   207
		fi
78
c014474497f0 Correct uninstall target.
user@gavenko
parents: 77
diff changeset
   208
	done
87
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
   209
	rm -f $(HOME)/.mc/bashrc $(HOME)/.mc/ini $(HOME)/.mc/bindings
63b568f99e3c Install manually Midnight Commander ini files as for Cygwin and Debian
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 79
diff changeset
   210
	rmdir $(HOME)/.mc || :
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   211
218
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   212
################################################################
249
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
   213
# Docs targets.
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
   214
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
   215
.PHONY: html
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
   216
html: $(HTML_FILES)
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
   217
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
   218
# --stylesheet=rst.css
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
   219
$(HTML_FILES): %.html: %.rst
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
   220
	$(RST2HTML) $*.rst $@
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
   221
22e93995e88a Add docs targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 234
diff changeset
   222
################################################################
218
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   223
# Clean targets.
92582492ecde Add heading.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 217
diff changeset
   224
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
   225
.PHONY: clean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   226
clean:
904
87a79ec44985 Target to create tarball with essential files (to be moved to Vagrant box).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 887
diff changeset
   227
	rm -f $(HTML_FILES) $(TARBALL)
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   228
13
9e590e7ef108 Adds .PHONY exactly before corresponding target.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 12
diff changeset
   229
.PHONY: distclean
0
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   230
distclean: clean
217
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   231
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   232
################################################################
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   233
# Helper target.
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   234
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   235
.PHONY: help
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   236
help:
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   237
	@echo
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   238
	@echo Supported targets:
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   239
	@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(MAKEFILE_LIST)
fdcf941346bb Print supported targets.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 216
diff changeset
   240