commit 4ecefd16c2e255dea1bdba4b57841c48ccaa5876
parent 6cd402bb697c9850268b3385c32315fea9153bb9
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sun, 22 Mar 2026 06:02:00 +0530
parent 6cd402bb697c9850268b3385c32315fea9153bb9
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sun, 22 Mar 2026 06:02:00 +0530
Add basic support for Earthfile Use variable name opt_ instead of pref_
diff --git a/config.h b/config.h @@ -27,7 +27,7 @@ const char *shake_argmap[] = "-with-rtsopts=-I0", "-outputdir=_shake", "-o", "_shake/build" }; -/*X(level type operation lookup name cmd cmd args) opt chain */ +/*{ X(level, type, operation, lookup name, cmd, cmd args | "") opt chain }*/ #define BUILD_SYSTEMS \ { X(1, FM_FIL, 0 , "Makefile" , "make", "") },\ { X(1, FM_FIL, 0 , "makefile" , "make", "") },\ @@ -63,7 +63,8 @@ const char *shake_argmap[] = { X(3, FM_FIL, 0 , "CMakePresets.json", "cmake" , "--preset", "default") },\ { X(3, FM_FIL, 0 , "APKBUILD" , "abuild" , "-r") },\ { X(3, FM_FIL, 0 , "PKGBUILD" , "makepkg" , "-i")} , \ -{ X(3, FM_FIL, 0 , "Shakefile.hs" , "ghc"), NULL, U(shake_argmap)} +{ X(3, FM_FIL, 0 , "Shakefile.hs" , "ghc", ""), NULL, U(shake_argmap)}, \ +{ X(3, FM_FIL, 0 , "Earthfile" , "earthly", "") }, static const maker_config_t makers[] = { BUILD_SYSTEMS
diff --git a/fmake.c b/fmake.c @@ -58,14 +58,14 @@ char *targets[256]; size_t targets_len = 0; static short should_execute_commands = 1; /* if 0 commands will be printed to stdout */ -static short pref_level_requested = 1; /* -1 indicates no level requested */ -static short pref_is_verbose = 0; +static short opt_level_requested = 1; /* -1 indicates no level requested */ +static short opt_is_verbose = 0; char *errormsg; size_t errormsg_len; #define info(...) \ - if (pref_is_verbose) { \ + if (opt_is_verbose) { \ fprintf(stderr, "fmake: " __VA_ARGS__); \ } @@ -142,7 +142,7 @@ check_files(int maker_i) info("%s\n", maker.filename); } while (++maker_i < makers_len - || makers[maker_i].level <= pref_level_requested); + || makers[maker_i].level <= opt_level_requested); if (maker_i == makers_len) maker_i = 0; @@ -384,7 +384,8 @@ main(int argc, char *argv[]) case '1': case '2': case '3': - pref_level_requested = atoi(&argv[argi][1]); + case '4': + opt_level_requested = atoi(&argv[argi][1]); break; case 'N': should_execute_commands = 0; @@ -394,7 +395,7 @@ main(int argc, char *argv[]) return 0; break; case 'D': - pref_is_verbose = 1; + opt_is_verbose = 1; break; case '?': fmake_usage(0); @@ -419,7 +420,7 @@ FMAKE_AFTER_ARG_CHECK: #endif /* foward through levels if requested */ - while (makers[++argi].level < pref_level_requested); + while (makers[++argi].level < opt_level_requested); maker = makers[check_files(argi)];
: nply/fmake