@@ -21,12 +21,13 @@ DOCS_DIR := docs
21
21
CONF_DIR := conf
22
22
AWK_DIR := awklib
23
23
FUNCS_DIR := func
24
+ FILE_EXT := .sh
24
25
INDENT := $(shell echo -e " ")
25
26
USAGE = $(NAME ) [OPTIONS]
26
27
OPTIONS_FILE := options
27
28
MANPAGE = $(NAME ) .1
28
- MONOLITH = _$(NAME ) .sh
29
- BASE := _init.sh
29
+ MONOLITH = _$(NAME )$( FILE_EXT )
30
+ BASE := _init$( FILE_EXT )
30
31
SHBANG := \# !/bin/bash
31
32
OPTIONS_ARRAY_NAME := _o
32
33
MANPAGE_OUT = _$(MANPAGE )
@@ -37,8 +38,8 @@ ifneq ($(wildcard config.mak),)
37
38
endif
38
39
39
40
manpage_section = $(subst .,,$(suffix $(MANPAGE ) ) )
40
- function_createconf := $(FUNCS_DIR ) /_createconf.sh
41
- function_awklib := $(FUNCS_DIR ) /_awklib.sh
41
+ function_createconf := $(FUNCS_DIR ) /_createconf$( FILE_EXT )
42
+ function_awklib := $(FUNCS_DIR ) /_awklib$( FILE_EXT )
42
43
43
44
ifneq ($(wildcard $(CONF_DIR ) /* ) ,)
44
45
include_createconf = $(function_createconf )
@@ -98,13 +99,13 @@ uninstall-dev: $(PREFIX)/bin/$(NAME)
98
99
check : all
99
100
shellcheck $(MONOLITH )
100
101
101
- $(BASE ) : config.mak $(CACHE_DIR ) /getopt $(CACHE_DIR ) /print_help.sh $(CACHE_DIR ) /print_version.sh $(CACHE_DIR ) /got_func
102
+ $(BASE ) : config.mak $(CACHE_DIR ) /getopt $(CACHE_DIR ) /print_help$( FILE_EXT ) $(CACHE_DIR ) /print_version$( FILE_EXT ) $(CACHE_DIR ) /got_func
102
103
@$(info making $@ )
103
104
{
104
105
printf ' %s\n' ' $(SHBANG)' ' '
105
106
106
- grep -vhE -e '^# !/' $(CACHE_DIR)/print_version.sh | sed '0,/2/s//3/'
107
- grep -vhE -e '^# !/' $(CACHE_DIR)/print_help.sh | sed '0,/2/s//3/'
107
+ grep -vhE -e '^# !/' $(CACHE_DIR)/print_version$(FILE_EXT) | sed '0,/2/s//3/'
108
+ grep -vhE -e '^# !/' $(CACHE_DIR)/print_help$(FILE_EXT) | sed '0,/2/s//3/'
108
109
109
110
echo
110
111
@@ -124,7 +125,7 @@ $(BASE): config.mak $(CACHE_DIR)/getopt $(CACHE_DIR)/print_help.sh $(CACHE_DIR)/
124
125
echo 'main "$$@"'
125
126
} > $@
126
127
127
- $(MONOLITH ) : $(CACHE_DIR ) /print_version.sh $(NAME ) $(CACHE_DIR ) /print_help.sh $(function_files ) $(CACHE_DIR ) /getopt
128
+ $(MONOLITH ) : $(CACHE_DIR ) /print_version$( FILE_EXT ) $(NAME ) $(CACHE_DIR ) /print_help$( FILE_EXT ) $(function_files ) $(CACHE_DIR ) /getopt
128
129
@$(info making $@ )
129
130
{
130
131
printf ' %s\n' ' $(SHBANG)' ' '
@@ -145,17 +146,16 @@ $(CACHE_DIR)/copyright.txt: config.mak
145
146
@$(info making $@ )
146
147
year_created=$(CREATED ) year_created=$$ {year_created%%-* }
147
148
year_updated=$$(date +'%Y' )
149
+ author=" $( AUTHOR) " org=$(ORGANISATION )
148
150
149
151
copy_text="Copyright (c) "
150
152
151
153
((year_created == year_updated)) \
152
154
&& copy_text+=$$year_created \
153
155
|| copy_text+="$${year_created}-$${year_updated}"
154
156
155
- copy_text+=", $(AUTHOR)"
156
-
157
- [[ $${org:=$(ORGANISATION)} ]] \
158
- && copy_text+=" of $(ORGANISATION) "
157
+ [[ $$author ]] && copy_text+=", $$author"
158
+ [[ $$org ]] && copy_text+=" of $$org "
159
159
160
160
printf '%s\n' \
161
161
"$$copy_text" "SPDX-License-Identifier: $(LICENSE)" > $@
@@ -195,7 +195,7 @@ $(CACHE_DIR)/help_table.txt: $(CACHE_DIR)/long_help.md
195
195
paste <(echo "$$frag") <(echo "$$desc") | tr -d '\t'
196
196
done > $@
197
197
198
- $(CACHE_DIR ) /print_version.sh : config.mak | $(CACHE_DIR ) /
198
+ $(CACHE_DIR ) /print_version$( FILE_EXT ) : config.mak | $(CACHE_DIR ) /
199
199
@$(info making $@ )
200
200
echo $(SHBANG )
201
201
fstyle=$(FUNC_STYLE )
@@ -207,7 +207,7 @@ $(CACHE_DIR)/print_version.sh: config.mak | $(CACHE_DIR)/
207
207
" }" \
208
208
" " >> $@
209
209
210
- $(CACHE_DIR ) /print_help.sh : $(CACHE_DIR ) /help_table.txt $(CACHE_DIR ) /synopsis.txt
210
+ $(CACHE_DIR ) /print_help$( FILE_EXT ) : $(CACHE_DIR ) /help_table.txt $(CACHE_DIR ) /synopsis.txt
211
211
@$(info making $@ )
212
212
{
213
213
echo $(SHBANG )
0 commit comments