Skip to content

Commit

Permalink
Dedup some markdown -> C++ big literal stuff in build system
Browse files Browse the repository at this point in the history
This pattern rule was unwisely hidden in `src/libstore/local.mk`. Now it
is properly in `mk/` and we reuse it for the profile docs too.
  • Loading branch information
Ericson2314 committed May 15, 2023
1 parent 0c49c1a commit f7c896c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
5 changes: 5 additions & 0 deletions mk/cxx-big-literal.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%.gen.hh: %
@echo 'R"foo(' >> $@.tmp
$(trace-gen) cat $< >> $@.tmp
@echo ')foo"' >> $@.tmp
@mv $@.tmp $@
1 change: 1 addition & 0 deletions mk/lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ include mk/libraries.mk
include mk/programs.mk
include mk/patterns.mk
include mk/templates.mk
include mk/cxx-big-literal.mk
include mk/tests.mk


Expand Down
6 changes: 0 additions & 6 deletions src/libstore/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ $(d)/local-store.cc: $(d)/schema.sql.gen.hh $(d)/ca-specific-schema.sql.gen.hh

$(d)/build.cc:

%.gen.hh: %
@echo 'R"foo(' >> $@.tmp
$(trace-gen) cat $< >> $@.tmp
@echo ')foo"' >> $@.tmp
@mv $@.tmp $@

clean-files += $(d)/schema.sql.gen.hh $(d)/ca-specific-schema.sql.gen.hh

$(eval $(call install-file-in, $(d)/nix-store.pc, $(libdir)/pkgconfig, 0644))
Expand Down
8 changes: 4 additions & 4 deletions src/nix/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ src/nix-channel/nix-channel.cc: src/nix-channel/unpack-channel.nix.gen.hh

src/nix/main.cc: doc/manual/generate-manpage.nix.gen.hh doc/manual/utils.nix.gen.hh

src/nix/profile.cc: src/nix/profile.md src/nix/doc/files/profiles.md

src/nix/doc/files/%.md: doc/manual/src/command-ref/files/%.md
mkdir -p $$(dirname $@)
( printf 'R""(\n'; cat $^; printf '\n)""' ) > $@
@mkdir -p $$(dirname $@)
@cp $< $@

src/nix/profile.cc: src/nix/profile.md src/nix/doc/files/profiles.md.gen.hh
2 changes: 1 addition & 1 deletion src/nix/profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ them to be rolled back easily.

)""

#include "doc/files/profiles.md"
#include "doc/files/profiles.md.gen.hh"

R""(

Expand Down

0 comments on commit f7c896c

Please sign in to comment.