Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Via Christus
avadanlık
Commits
916764ba
Unverified
Commit
916764ba
authored
Feb 15, 2019
by
Caleb Maclennan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Overhaul input/output sync to hopefully work the same both directions
parent
addd8e92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
18 deletions
+34
-18
makefile
makefile
+34
-18
No files found.
makefile
View file @
916764ba
...
...
@@ -67,7 +67,7 @@ endif
ALLTAGS
:=
$(
strip
$(
shell
git tag
--points-at
HEAD | xargs
echo
)
$(
and
$(
findstring
/,
$(BRANCH)
)
,
$(BRANCH)
))
ifneq
($(ALLTAGS),)
# If we are on a tagged release
, don't do pre-sync
# If we are on a tagged release
cut pre-sync off at the knees and always build fresh
undefine
INPUTDIR
DIFF
=
false
...
...
@@ -99,11 +99,11 @@ endif
# End non-tagged
endif
# Assume OUTPATH
S
is always used in a foreach loop with TARGET variable set
# Assume OUTPATH is always used in a foreach loop with TARGET variable set
ifeq
($(BRANCH),master)
OUTPATH
S
=
$(TARGET)
$(
and
$(TA
RGET)
,
$(TAGNAME)
,
$(TARGET)
/
$(TAGNAME)
)
OUTPATH
=
$(TARGET)
$(
and
$(TA
GNAME)
,
/
$(TAGNAME)
)
else
OUTPATH
S
=
$(BRANCH)
OUTPATH
=
$(BRANCH)
endif
# If there is a layout associated with a tag, only build that layout
...
...
@@ -120,8 +120,6 @@ endif
ifeq
($(MAKECMDGOALS),ci)
sync_pre
:
init debug
pdfs renderings promotionals
:
sync_pre
sync_post
:
pdfs renderings promotionals
ci
:
sync_pre sync_post
endif
debug
:
debug_avadanlik
...
...
@@ -131,8 +129,10 @@ debug: debug_avadanlik
debug_avadanlik
:
@
echo
AVADANLIKDIR:
$(AVADANLIKDIR)
@
echo
BRANCH:
$(BRANCH)
@
echo
INPUTDIR:
$(INPUTDIR)
@
echo
OUTPATH:
$(OUTPATH)
@
echo
OUTPUTDIR:
$(OUTPUTDIR)
@
echo
TAGNAME:
$(TAGNAME)
@
echo
OUTPATHS:
$(OUTPATHS)
check_dependencies
:
check_dependencies_avadanlik
...
...
@@ -162,7 +162,7 @@ $(UPDATATAGTARGETS): update_%_tags:
init
:
init_avadanlik
.PHONY
:
init_avadanlik
init_avadanlik
:
time_warp_avadanlik $(AVADANLIKDIR)/yarn.lock
init_avadanlik
:
time_warp_avadanlik $(AVADANLIKDIR)/yarn.lock
$(OUTPUTDIR)
$(AVADANLIKDIR)/yarn.lock
:
$(AVADANLIKDIR)/package.json
cd
$(AVADANLIKDIR)
&&
yarn
install
...
...
@@ -181,27 +181,43 @@ time_warp: time_warp_avadanlik
time_warp_avadanlik
:
$(
call
time_warp,
$(AVADANLIKDIR)
)
$(OUTPUTDIR)
:
mkdir
-p
$@
# Create per book jobs in the CI config
define
ci_setup
?=
yq
-M
-s
-y
-e
--arg
sources
"$(strip $(SOURCES))"
\
'. + ($$sources | [splits(" ") as $$target | { ($$target + ".pdfs") : { "extends": ".pdfs", "only": [ "master", ("/^"+$$target+"\\/.*/") ], "artifacts": { "paths": [($$target+"*")] } }}]) | add'
endef
require_inputdir
:=
$(
or
$(
strip
$(INPUTDIR)
)
,fail
)
.PHONY
:
sync_pre
sync_pre
:
| $(require_pubdir) $(require_outputdir)
$(
and
$(INPUTDIR)
,rsync
-utv
$(INPUTDIR)
/
*
$(PROJECTDIR)
/
||
:
)
$(
and
$(INPUTDIR)
,
$(
foreach
TARGET,
$(TARGETS)
,rsync
-utv
$(INPUTDIR)
/
$(TARGET)
/
*
$(PROJECTDIR)
/
||
:
;
))
sync_pre
:
| $(require_inputdir)
$(
foreach
TARGET,
$(TARGETS)
,
find
$(INPUTDIR)
/
$(OUTPATH)
/
-maxdepth
1
-type
f
\(
\
-name
"
$(TARGET)
*"
\
$(
and
$(
call
printisbn,
$(TARGET)
)
,-or
-name
"
$(
call
printisbn,
$(TARGET)
)
*"
)
\
$(
and
$(
call
ebookisbn,
$(TARGET)
)
,-or
-name
"
$(
call
ebookisbn,
$(TARGET)
)
*"
)
\
\)
-execdir
rsync
-utv
{
}
$(PROJECTDIR)
/
\;
;
)
ifneq
($(strip $(TARGETS)),$(strip $(PROJECT)))
find
$(INPUTDIR)
/
-maxdepth
1
-type
f
\
-name
"
$(PROJECT)
*"
\
-execdir
rsync
-utv
{}
$(PROJECTDIR)
/
\;
endif
require_outputdir
:=
$(
or
$(
strip
$(OUTPUTDIR)
)
,fail
)
.PHONY
:
sync_post
sync_post
:
| $(require_pubdir) $(require_outputdir)
$(
foreach
TARGET,
$(TARGETS)
,
$(
foreach
OUTPATH,
$(OUTPATHS)
,
mkdir
-p
$(OUTPUTDIR)
/
$(OUTPATH)
;
)
find
$(PUBDIR)
-type
f
\(
\
-name
"
$(TARGET)
*"
\
$(
and
$(
call
printisbn,
$(TARGET)
)
,-or
-name
"
$(
call
printisbn,
$(TARGET)
)
*"
)
\
$(
and
$(
call
ebookisbn,
$(TARGET)
)
,-or
-name
"
$(
call
ebookisbn,
$(TARGET)
)
*"
)
\
\)
$(
foreach
OUTPATH,
$(OUTPATHS)
,
-execdir
rsync
-ct
{
}
$(OUTPUTDIR)
/
$(OUTPATH)
/
\;
)
;
)
$(
foreach
TARGET,
$(TARGETS)
,mkdir
-p
$(OUTPUTDIR)
/
$(OUTPATH)
;
find
$(PUBDIR)
/
-maxdepth
1
-type
f
\(
\
-name
"
$(TARGET)
*"
\
$(
and
$(
call
printisbn,
$(TARGET)
)
,-or
-name
"
$(
call
printisbn,
$(TARGET)
)
*"
)
\
$(
and
$(
call
ebookisbn,
$(TARGET)
)
,-or
-name
"
$(
call
ebookisbn,
$(TARGET)
)
*"
)
\
\)
-execdir
rsync
-ct
{
}
$(OUTPUTDIR)
/
$(OUTPATH)
/
\;
;
)
ifneq
($(strip $(TARGETS)),$(strip $(PROJECT)))
find
$(PUBDIR)
-type
f
\
find
$(PUBDIR)
/-maxdepth 1
-type
f
\
-name
"
$(PROJECT)
*"
\
-execdir
rsync
-ct
{}
$(OUTPUTDIR)
/
\;
endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment