Skip to content

Commit 15fe09b

Browse files
committed
[FIX] rename makefile -> GNUmakefile
also make root makefile symlink to data/default/makefile
1 parent 9088436 commit 15fe09b

File tree

4 files changed

+19
-474
lines changed

4 files changed

+19
-474
lines changed

Diff for: GNUmakefile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
data/default/GNUmakefile

Diff for: config.mak

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ ORGANISATION := budlabs
88
CONTACT := https://github.com/budlabs/bashbud
99
USAGE := bashbud [OPTIONS] [DIRECTORY]
1010

11-
CUSTOM_TARGETS += data/default/Makefile
11+
.PHONY: makefile
12+
makefile: data/default/GNUmakefile
13+
CUSTOM_TARGETS += makefile
1214

13-
data/default/Makefile: $(wildcard Makefile.d/*)
15+
data/default/GNUmakefile: $(wildcard Makefile.d/*)
1416
@$(info genearating Makefile from Makefile.d)
1517
cat $^ > $@
16-
cp -f $@ Makefile
1718

1819
MANPAGE_DEPS = \
1920
$(CACHE_DIR)/help_table.txt \

Diff for: Makefile renamed to data/default/GNUmakefile

+14-14
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ DOCS_DIR := docs
2121
CONF_DIR := conf
2222
AWK_DIR := awklib
2323
FUNCS_DIR := func
24+
FILE_EXT := .sh
2425
INDENT := $(shell echo -e " ")
2526
USAGE = $(NAME) [OPTIONS]
2627
OPTIONS_FILE := options
2728
MANPAGE = $(NAME).1
28-
MONOLITH = _$(NAME).sh
29-
BASE := _init.sh
29+
MONOLITH = _$(NAME)$(FILE_EXT)
30+
BASE := _init$(FILE_EXT)
3031
SHBANG := \#!/bin/bash
3132
OPTIONS_ARRAY_NAME := _o
3233
MANPAGE_OUT = _$(MANPAGE)
@@ -37,8 +38,8 @@ ifneq ($(wildcard config.mak),)
3738
endif
3839

3940
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)
4243

4344
ifneq ($(wildcard $(CONF_DIR)/*),)
4445
include_createconf = $(function_createconf)
@@ -98,13 +99,13 @@ uninstall-dev: $(PREFIX)/bin/$(NAME)
9899
check: all
99100
shellcheck $(MONOLITH)
100101

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
102103
@$(info making $@)
103104
{
104105
printf '%s\n' '$(SHBANG)' ''
105106

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/'
108109

109110
echo
110111

@@ -124,7 +125,7 @@ $(BASE): config.mak $(CACHE_DIR)/getopt $(CACHE_DIR)/print_help.sh $(CACHE_DIR)/
124125
echo 'main "$$@"'
125126
} > $@
126127

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
128129
@$(info making $@)
129130
{
130131
printf '%s\n' '$(SHBANG)' ''
@@ -145,17 +146,16 @@ $(CACHE_DIR)/copyright.txt: config.mak
145146
@$(info making $@)
146147
year_created=$(CREATED) year_created=$${year_created%%-*}
147148
year_updated=$$(date +'%Y')
149+
author="$(AUTHOR)" org=$(ORGANISATION)
148150

149151
copy_text="Copyright (c) "
150152

151153
((year_created == year_updated)) \
152154
&& copy_text+=$$year_created \
153155
|| copy_text+="$${year_created}-$${year_updated}"
154156

155-
copy_text+=", $(AUTHOR)"
156-
157-
[[ $${org:=$(ORGANISATION)} ]] \
158-
&& copy_text+=" of $(ORGANISATION) "
157+
[[ $$author ]] && copy_text+=", $$author"
158+
[[ $$org ]] && copy_text+=" of $$org "
159159

160160
printf '%s\n' \
161161
"$$copy_text" "SPDX-License-Identifier: $(LICENSE)" > $@
@@ -195,7 +195,7 @@ $(CACHE_DIR)/help_table.txt: $(CACHE_DIR)/long_help.md
195195
paste <(echo "$$frag") <(echo "$$desc") | tr -d '\t'
196196
done > $@
197197

198-
$(CACHE_DIR)/print_version.sh: config.mak | $(CACHE_DIR)/
198+
$(CACHE_DIR)/print_version$(FILE_EXT): config.mak | $(CACHE_DIR)/
199199
@$(info making $@)
200200
echo $(SHBANG)
201201
fstyle=$(FUNC_STYLE)
@@ -207,7 +207,7 @@ $(CACHE_DIR)/print_version.sh: config.mak | $(CACHE_DIR)/
207207
"}" \
208208
"" >> $@
209209

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
211211
@$(info making $@)
212212
{
213213
echo $(SHBANG)

0 commit comments

Comments
 (0)