diff options
| author | 2026-11-06 03:42:59 +0000 | |
|---|---|---|
| committer | 2026-11-06 07:16:12 +0000 | |
| commit | 9e8a4d26533b82c22529393518ac323c1f3612fd (patch) | |
| tree | 9ee7524d665c6fee63631507c83a4b80315bb27e /cmk.h | |
| parent | feat(cmk): add C make (diff) | |
| download | codebase-devel.tar.gz | |
Diffstat (limited to 'cmk.h')
| -rw-r--r-- | cmk.h | 63 |
1 files changed, 63 insertions, 0 deletions
| @@ -0,0 +1,63 @@ | |||
| 1 | // cmk.c --- build system of this repo -*- C -*- | ||
| 2 | // | ||
| 3 | // Copyright (c) 2026 Martin Michalec <martin@michalec.dev> | ||
| 4 | // | ||
| 5 | // SPDX-License-Identifier: MIT | ||
| 6 | // | ||
| 7 | // This file is part of COSMOS Codebase. | ||
| 8 | // | ||
| 9 | // Commentary: | ||
| 10 | // | ||
| 11 | // Code: | ||
| 12 | |||
| 13 | #ifndef INCLUDED_COSMOS_CODEBASE_CMK_H | ||
| 14 | #define INCLUDED_COSMOS_CODEBASE_CMK_H | ||
| 15 | |||
| 16 | #include "dbg.h" | ||
| 17 | #include "mv.h" | ||
| 18 | #include "da.h" | ||
| 19 | |||
| 20 | #define COSMOS_CODEBASE_PROFILE_LIST(...) \ | ||
| 21 | X (REL_WITH_DEBINFO, "rel-with-debinfo", ##__VA_ARGS__) \ | ||
| 22 | X (RELEASE, "release", ##__VA_ARGS__) \ | ||
| 23 | X (REL_MIN_SIZE, "rel-min-size", ##__VA_ARGS__) \ | ||
| 24 | X (DEVEL, "devel", ##__VA_ARGS__) | ||
| 25 | |||
| 26 | #define X(sym, ...) COSMOS_CODEBASE_PROFILE_ ## sym, | ||
| 27 | enum cosmos_codebase_profile { | ||
| 28 | COSMOS_CODEBASE_PROFILE_LIST () | ||
| 29 | COSMOS_CODEBASE_PROFILE_CNT | ||
| 30 | }; | ||
| 31 | #undef X | ||
| 32 | |||
| 33 | extern const struct mb cosmos_codebase_profile_names[COSMOS_CODEBASE_PROFILE_CNT]; | ||
| 34 | |||
| 35 | static inline struct mv | ||
| 36 | cosmos_codebase_profile_name (enum cosmos_codebase_profile profile) | ||
| 37 | { | ||
| 38 | DBG_ASSERT_IN (0, profile, COSMOS_CODEBASE_PROFILE_CNT - 1, "%d", "%d", "%d"); | ||
| 39 | return mv_from_mb (cosmos_codebase_profile_names[profile]); | ||
| 40 | } | ||
| 41 | |||
| 42 | struct cosmos_codebase_config { | ||
| 43 | struct mv ns; | ||
| 44 | struct mv root; | ||
| 45 | struct mv include; | ||
| 46 | struct mv src; | ||
| 47 | struct mv build; | ||
| 48 | struct mv obj; | ||
| 49 | struct mv dep; | ||
| 50 | struct mv bin; | ||
| 51 | struct mv cc; | ||
| 52 | struct mv_da cflags; | ||
| 53 | struct mv_da ldflags; | ||
| 54 | }; | ||
| 55 | |||
| 56 | extern struct cosmos_codebase_config cosmos_codebase_config; | ||
| 57 | |||
| 58 | void cosmos_codebase_configure (enum cosmos_codebase_profile, struct mv ns, struct mv root, struct mv build, struct mv cc); | ||
| 59 | void cosmos_codebase (void); | ||
| 60 | |||
| 61 | #endif // INCLUDED_COSMOS_CODEBASE_CMK_H | ||
| 62 | |||
| 63 | // cmk.h ends here | ||
