Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
portail
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FIL L3 Stage
portail
Commits
bbe495ee
Commit
bbe495ee
authored
2 years ago
by
Damien Pollet
Browse files
Options
Downloads
Patches
Plain Diff
Comment the makefile
parent
6117b3ae
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Makefile
+33
-7
33 additions, 7 deletions
Makefile
with
33 additions
and
7 deletions
Makefile
+
33
−
7
View file @
bbe495ee
# Root of the tree of source files.
# The build converts *.md only, any copies all other files verbatim.
SRC
:=
content
# Publishable tree, generated from $(SRC).
# Have a look, but don't edit those.
OUT
:=
output
# Sets of source files or build targets. Internal.
SRC_MARKUP
:=
$(
shell find
$(
SRC
)
-type
f
-name
'*.md'
)
SRC_OTHERS
:=
$(
shell find
$(
SRC
)
-type
f
-not
-name
'*.md'
)
SRC_DIRS
:=
$(
shell find
$(
SRC
)
-type
d
-mindepth
1
)
...
...
@@ -9,14 +15,14 @@ OUT_MARKUP := $(SRC_MARKUP:$(SRC)/%.md=$(OUT)/%.php)
OUT_OTHERS
:=
$(
SRC_OTHERS:
$(
SRC
)
/%
=
$(
OUT
)
/%
)
OUT_DIRS
:=
$(
SRC_DIRS:
$(
SRC
)
/%
=
$(
OUT
)
/%
)
.PHONY
:
prepare
build publish clean
.PHONY
:
build publish clean
.DEFAULT_GOAL
:=
build
prepare
:
$(OUT)/.git
# Main entry point targets
build
:
$(OUT_MARKUP) $(OUT_OTHERS)
build
:
$(OUT_MARKUP) $(OUT_OTHERS)
##
Generate publishable files
,
converting *.md to *.php
publish
:
|
prepare build
publish
:
|
$(OUT)/.git build
##
Build then push to the 'public' branch if there are changes
if
[
-n
"
$$(
git -C
$(
OUT
)
status --porcelain
)
"
]
;
then
\
cd
$(
OUT
)
;
\
git add
.
;
\
...
...
@@ -24,12 +30,16 @@ publish : | prepare build
git push
--push-option
ci.skip origin
'HEAD:public'
;
\
fi
clean
:
clean
:
##
Wipe all generated files
rm
-fr
$(
OUT
)
git worktree prune
# Ensure $(OUT) is setup for publishing, by making it a wortree for the 'public' branch.
# Under CI, commit as whoever caused the build, but authentify using a token (environment variable
# DEPLOY_TOKEN set from the gitlab side)
$(OUT)/.git
:
git fetch origin public
make clean
git fetch origin
'public:public'
git worktree add
--no-checkout
$(
OUT
)
public
if
[
"
$$
CI"
==
'true'
-a
-n
"
$$
DEPLOY_TOKEN"
]
;
then
\
git config user.name
"
$$
GITLAB_USER_NAME"
;
\
...
...
@@ -43,10 +53,26 @@ $(OUT) :
$(OUT_DIRS)
:
$(OUT)
@
mkdir
-p
$@
.SECONDEXPANSION
:
#
oooh
,
magic *_*
.SECONDEXPANSION
:
#
oooh
,
magic *_*
(needed to ensure parent directories exist)
$(OUT)/%
:
$(SRC)/% | $$(@D)
cp
$<
$@
$(OUT)/%.php
:
$(SRC)/%.md signature.html | $$(@D)
pandoc
--output
$@
--template
signature
--from
markdown
--to
html
$<
# Some shell magic to auto-document the main targets. To have a target appear in
# the output, add a short, one-line comment with a double ## on the same line as
# the target.
#
# See http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY
:
help
help
:
##
Describe the main targets (this list)
@
echo
"Main targets you can build:"
@
awk
-F
':|## *'
\
'/^[^\t].+:[^=].*##/ {\
printf " \033[36m%s\033[0m#%s\n", $$1, $$NF \
}'
$(
MAKEFILE_LIST
)
\
| column
-s
# -t
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment