aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-make
diff options
context:
space:
mode:
Diffstat (limited to 'src/blogc-make')
-rw-r--r--src/blogc-make/ctx.c2
-rw-r--r--src/blogc-make/ctx.h2
-rw-r--r--src/blogc-make/exec.c9
-rw-r--r--src/blogc-make/exec.h2
-rw-r--r--src/blogc-make/main.c18
5 files changed, 16 insertions, 17 deletions
diff --git a/src/blogc-make/ctx.c b/src/blogc-make/ctx.c
index 636a39a..c7d6ca9 100644
--- a/src/blogc-make/ctx.c
+++ b/src/blogc-make/ctx.c
@@ -148,7 +148,7 @@ bm_ctx_new(bm_ctx_t *base, const char *settings_file, const char *argv0,
rv->blogc = bm_exec_find_binary(argv0, "blogc", "BLOGC");
rv->blogc_runserver = bm_exec_find_binary(argv0, "blogc-runserver",
"BLOGC_RUNSERVER");
- rv->production = false;
+ rv->dev = false;
rv->verbose = false;
}
else {
diff --git a/src/blogc-make/ctx.h b/src/blogc-make/ctx.h
index 67d0a7d..14e913f 100644
--- a/src/blogc-make/ctx.h
+++ b/src/blogc-make/ctx.h
@@ -45,7 +45,7 @@ typedef struct {
char *blogc;
char *blogc_runserver;
- bool production;
+ bool dev;
bool verbose;
bm_settings_t *settings;
diff --git a/src/blogc-make/exec.c b/src/blogc-make/exec.c
index ca57e62..425f728 100644
--- a/src/blogc-make/exec.c
+++ b/src/blogc-make/exec.c
@@ -205,7 +205,7 @@ list_variables(const char *key, const char *value, bc_string_t *str)
char*
bm_exec_build_blogc_cmd(const char *blogc_bin, bm_settings_t *settings,
bc_trie_t *variables, bool listing, const char *template,
- const char *output, bool production, bool sources_stdin)
+ const char *output, bool dev, bool sources_stdin)
{
bc_string_t *rv = bc_string_new();
@@ -228,9 +228,8 @@ bm_exec_build_blogc_cmd(const char *blogc_bin, bm_settings_t *settings,
bc_trie_foreach(variables, (bc_trie_foreach_func_t) list_variables, rv);
- if (production) {
- bc_string_append(rv,
- " -D MAKE_ENV_PRODUCTION=1 -D MAKE_ENV='production'");
+ if (dev) {
+ bc_string_append(rv, " -D MAKE_ENV_DEV=1 -D MAKE_ENV='dev'");
}
if (listing) {
@@ -273,7 +272,7 @@ bm_exec_blogc(bm_ctx_t *ctx, bc_trie_t *variables, bool listing,
}
char *cmd = bm_exec_build_blogc_cmd(ctx->blogc, ctx->settings, variables,
- listing, template->path, output->path, ctx->production, input->len > 0);
+ listing, template->path, output->path, ctx->dev, input->len > 0);
if (ctx->verbose)
printf("%s\n", cmd);
diff --git a/src/blogc-make/exec.h b/src/blogc-make/exec.h
index fadaafe..715c903 100644
--- a/src/blogc-make/exec.h
+++ b/src/blogc-make/exec.h
@@ -20,7 +20,7 @@ int bm_exec_command(const char *cmd, const char *input, char **output,
char **error, bc_error_t **err);
char* bm_exec_build_blogc_cmd(const char *blogc_bin, bm_settings_t *settings,
bc_trie_t *variables, bool listing, const char *template,
- const char *output, bool production, bool sources_stdin);
+ const char *output, bool dev, bool sources_stdin);
int bm_exec_blogc(bm_ctx_t *ctx, bc_trie_t *variables, bool listing,
bm_filectx_t *template, bm_filectx_t *output, bc_slist_t *sources,
bool only_first_source);
diff --git a/src/blogc-make/main.c b/src/blogc-make/main.c
index eb7f504..8c73e13 100644
--- a/src/blogc-make/main.c
+++ b/src/blogc-make/main.c
@@ -25,7 +25,7 @@ print_help(void)
{
printf(
"usage:\n"
- " blogc-make [-h] [-v] [-V] [-f FILE] [RULE ...]\n"
+ " blogc-make [-h] [-v] [-D] [-V] [-f FILE] [RULE ...]\n"
" - A simple build tool for blogc.\n"
"\n"
"positional arguments:\n"
@@ -35,9 +35,9 @@ print_help(void)
"optional arguments:\n"
" -h show this help message and exit\n"
" -v show version and exit\n"
+ " -D build for development environment\n"
" -V be verbose when executing commands\n"
- " -f FILE read FILE as blogcfile\n"
- " -p build for production environment\n");
+ " -f FILE read FILE as blogcfile\n");
bm_rule_print_help();
}
@@ -45,7 +45,7 @@ print_help(void)
static void
print_usage(void)
{
- printf("usage: blogc-make [-h] [-v] [-V] [-f FILE] [-p] [RULE ...]\n");
+ printf("usage: blogc-make [-h] [-v] [-D] [-V] [-f FILE] [RULE ...]\n");
}
@@ -63,7 +63,7 @@ main(int argc, char **argv)
bc_slist_t *rules = NULL;
bool verbose = false;
- bool production = false;
+ bool dev = false;
char *blogcfile = NULL;
bm_ctx_t *ctx = NULL;
@@ -76,6 +76,9 @@ main(int argc, char **argv)
case 'v':
printf("%s\n", PACKAGE_STRING);
goto cleanup;
+ case 'D':
+ dev = true;
+ break;
case 'V':
verbose = true;
break;
@@ -85,9 +88,6 @@ main(int argc, char **argv)
else if (i + 1 < argc)
blogcfile = bc_strdup(argv[++i]);
break;
- case 'p':
- production = true;
- break;
#ifdef MAKE_EMBEDDED
case 'm':
// no-op, for embedding into blogc binary.
@@ -117,7 +117,7 @@ main(int argc, char **argv)
rv = 3;
goto cleanup;
}
- ctx->production = production;
+ ctx->dev = dev;
ctx->verbose = verbose;
rv = bm_rule_executor(ctx, rules);