Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
08546e50
Commit
08546e50
authored
Jun 04, 2016
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run code-gen in a batch
This makes code generation MUCH MUCH faster.
parent
9dd337d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
11 deletions
+36
-11
Makefile
Makefile
+36
-11
No files found.
Makefile
View file @
08546e50
...
...
@@ -350,6 +350,17 @@ DEEPCOPY_DIRS := $(shell \
)
DEEPCOPY_FILES
:=
$
(
addsuffix /
$(DEEPCOPY_FILENAME)
,
$(DEEPCOPY_DIRS)
)
# This rule aggregates the set of files to generate and then generates them all
# in a single run of the tool.
.PHONY
:
gen_deepcopy
gen_deepcopy
:
$(DEEPCOPY_FILES)
@
if
[[
-f
$(META_DIR)
/
$(DEEPCOPY_GEN)
.todo
]]
;
then
\
$(DEEPCOPY_GEN)
\
-i
$$
(
cat
$(META_DIR)
/
$(DEEPCOPY_GEN)
.todo |
paste
-sd
,
)
\
--bounding-dirs
$(PRJ_SRC_PATH)
\
-O
$(DEEPCOPY_BASENAME)
;
\
fi
# For each dir in DEEPCOPY_DIRS, this establishes a dependency between the
# output file and the input files that should trigger a rebuild.
#
...
...
@@ -367,12 +378,13 @@ $(foreach dir, $(DEEPCOPY_DIRS), $(eval \
$(gofiles__$(dir))
\
))
# How to regenerate deep-copy code.
# Unilaterally remove any leftovers from previous runs.
$(shell
rm
-f
$(META_DIR)/$(DEEPCOPY_GEN)*.todo)
# How to regenerate deep-copy code. This is a little slow to run, so we batch
# it up and trigger the batch from the 'generated_files' target.
$(DEEPCOPY_FILES)
:
$(DEEPCOPY_GEN)
@
$(DEEPCOPY_GEN)
\
-i
$(PRJ_SRC_PATH)
/
$$
(
dirname
$@
)
\
--bounding-dirs
$(PRJ_SRC_PATH)
\
-O
$(DEEPCOPY_BASENAME)
@
echo
$(PRJ_SRC_PATH)
/
$
(
@D
)
>>
$(META_DIR)
/
$(DEEPCOPY_GEN)
.todo
# This calculates the dependencies for the generator tool, so we only rebuild
# it when needed. It is PHONY so that it always runs, but it only updates the
...
...
@@ -448,6 +460,16 @@ CONVERSION_DIRS := $(shell \
CONVERSION_FILES
:=
$
(
addsuffix /
$(CONVERSION_FILENAME)
,
$(CONVERSION_DIRS)
)
# This rule aggregates the set of files to generate and then generates them all
# in a single run of the tool.
.PHONY
:
gen_conversion
gen_conversion
:
$(CONVERSION_FILES)
@
if
[[
-f
$(META_DIR)
/
$(CONVERSION_GEN)
.todo
]]
;
then
\
$(CONVERSION_GEN)
\
-i
$$
(
cat
$(META_DIR)
/
$(CONVERSION_GEN)
.todo |
paste
-sd
,
)
\
-O
$(CONVERSION_BASENAME)
;
\
fi
# Establish a dependency between the deps file and the dir. Whenever a dir
# changes (files added or removed) the deps file will be considered stale.
#
...
...
@@ -532,11 +554,13 @@ $(foreach dir, $(CONVERSION_DIRS),
))
\
)
# How to regenerate conversion code.
# Unilaterally remove any leftovers from previous runs.
$(shell
rm
-f
$(META_DIR)/$(CONVERSION_GEN)*.todo)
# How to regenerate conversion code. This is a little slow to run, so we batch
# it up and trigger the batch from the 'generated_files' target.
$(CONVERSION_FILES)
:
$(CONVERSION_GEN)
@
$(CONVERSION_GEN)
\
-i
$(PRJ_SRC_PATH)
/
$
(
@D
)
\
-O
$(CONVERSION_BASENAME)
@
echo
$(PRJ_SRC_PATH)
/
$
(
@D
)
>>
$(META_DIR)
/
$(CONVERSION_GEN)
.todo
# This calculates the dependencies for the generator tool, so we only rebuild
# it when needed. It is PHONY so that it always runs, but it only updates the
...
...
@@ -563,7 +587,6 @@ sinclude $(META_DIR)/$(CONVERSION_GEN).mk
# How to build the generator tool. The deps for this are defined in
# the $(CONVERSION_GEN).mk, above.
#
#
# A word on the need to touch: This rule might trigger if, for example, a
# non-Go file was added or deleted from a directory on which this depends.
# This target needs to be reconsidered, but Go realizes it doesn't actually
...
...
@@ -576,4 +599,6 @@ $(CONVERSION_GEN):
# This rule collects all the generated file sets into a single dep, which is
# defined BELOW the *_FILES variables and leaves higher-level rules clean.
generated_files
:
$(DEEPCOPY_FILES) $(CONVERSION_FILES)
# Top-level rules should depend on this to ensure generated files are rebuilt.
.PHONY
:
generated_files
generated_files
:
gen_deepcopy gen_conversion
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