Bake was inspired by the Bash-based Shake utility (formerly eMake,
he liked my suggestion for a name). It is included under authorization
-of it's creator. The original version of Shake may be found at:
+of its creator. The original version of Shake may be found at:
<http://bis64wqhh3louusbd45iyj76kmn4rzw5ysawyan5bkxwyzihj67c5lid.onion/anon/shake>
Bake includes a modified Shake, both after installation and as a bootstrapper.
#include "config.h"
-#define START "@BAKE"
-#define STOP "@STOP"
-
-#define EXPUNGE_START "@{"
-#define EXPUNGE_STOP "}"
-
#define VERSION "20240408"
#define HELP \
enum {
BAKE_UNRECOGNIZED,
- BAKE_MISSING_SUFFIX,
+ BAKE_MISSING_SUFFIX
};
enum {
BAKE_RUN = 0,
BAKE_NORUN = (1 << 0),
- BAKE_EXPUNGE = (1 << 1),
+ BAKE_EXPUNGE = (1 << 1)
};
map(char * fn) {
struct stat s;
int fd;
- map_t m = (map_t) {
- 0
- };
+ map_t m;
+ m.buf = NULL;
+ m.len = 0;
fd = open(fn, O_RDONLY);
if (fd != -1) {
};
char * macro[MACRO_NONE],
- * macro_old[MACRO_STOP];
+ * macro_old[MACRO_STOP],
+ * global[MACRO_NONE];
size_t i;
macro_old[MACRO_SHORT ] = "$*";
macro_old[MACRO_ARGS ] = "$+";
- char * global[4];
-
global[MACRO_FILENAME] = filename;
global[MACRO_SHORT ] = shorten(filename);
global[MACRO_ARGS ] = all_args((size_t) argc, argv);
if (rm & BAKE_EXPUNGE) {
swap(buf + i + (f - i), x);
+#if !ENABLE_EXPUNGE_REMOVE
printf("%s: %sremoving '%s'\n",
argv0, rm & BAKE_NORUN ? "not " : "", buf + i);
if (!(rm & BAKE_NORUN)) {
remove(buf + i);
}
+#else
+ printf("%s: not removing '%s'\n", argv0, buf + i);
+#endif
swap(buf + i + (f - i), x);
}
goto stop;
}
- next:
+ next:;
}
stop:
static int
run(char * buf, char * argv0) {
- puts(BOLD GREEN "output" RESET ":\n");
pid_t pid;
+ puts(BOLD GREEN "output" RESET ":\n");
if ((pid = fork()) == 0) {
execl("/bin/sh", "sh", "-c", buf, NULL);
}
} while (++(argv[0]));
- next:
+ next:;
}
filename = argv[0];
/* preferred, @FILENAME @SHORT @ARGS */
#define NEW_MACROS 1
+
/* $@ $* $+ */
#define OLD_MACROS 1
-/* ./bake bake will compile bake.c, basically just proves that binary files really are supported,
- * the bake.c file must exist next to the executable for this work correctly. Not meant as a serious feature,
- * DO NOT enable this by default or in user builds. */
+/* Disables the possibility of remove(1) ever being ran */
+#define ENABLE_EXPUNGE_REMOVE 0
+
+/* ./bake bake will compile bake.c, basically just proves that binary files
+ * really are supported, the bake.c file must exist next to the executable for
+ * this work correctly. Not meant as a serious feature, DO NOT enable this by
+ * default or in user builds.
+ */
#define INCLUDE_AUTONOMOUS_COMPILE 0
#if ENABLE_COLOR == 1
# define BOLD
# define RESET
#endif
+
+/* It's best if you don't change these */
+
+/* sed -i 's/@COMPILECMD/@BAKE/g' <<<YOUR FILES...>>> */
+#define I_USE_LEGACY_CODE_AND_REFUSE_TO_UPGRADE 0
+
+#if I_USE_LEGACY_CODE_AND_REFUSE_TO_UPGRADE
+# define START "@COMPILECMD"
+# warning | use sed -i 's/@COMPILECMD/@BAKE/g' <YOUR LEGACY FILES...> instead
+#endif /* I_USE_LEGACY_CODE_AND_REFUSE_TO_UPGRADE */
+
+#undef START
+#define START "@BAKE"
+#define STOP "@STOP"
+
+#define EXPUNGE_START "@{"
+#define EXPUNGE_STOP "}"