aboutsummaryrefslogtreecommitdiff
path: root/cmk.h
blob: fe1b7ebbfdc20591150be883314305c057af032e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// cmk.c --- build system of this repo                                 -*- C -*-
//
// Copyright (c) 2026 Martin Michalec <martin@michalec.dev>
//
// SPDX-License-Identifier: MIT
//
// This file is part of COSMOS Codebase.
//
// Commentary:
//
// Code:

#ifndef INCLUDED_COSMOS_CODEBASE_CMK_H
#define INCLUDED_COSMOS_CODEBASE_CMK_H

#include "dbg.h"
#include "mv.h"
#include "da.h"

#define COSMOS_CODEBASE_PROFILE_LIST(...)                       \
  X (REL_WITH_DEBINFO, "rel-with-debinfo", ##__VA_ARGS__)       \
  X (RELEASE,          "release",          ##__VA_ARGS__)       \
  X (REL_MIN_SIZE,     "rel-min-size",     ##__VA_ARGS__)       \
  X (DEVEL,            "devel",            ##__VA_ARGS__)

#define X(sym, ...) COSMOS_CODEBASE_PROFILE_ ## sym,
enum cosmos_codebase_profile {
  COSMOS_CODEBASE_PROFILE_LIST ()
  COSMOS_CODEBASE_PROFILE_CNT
};
#undef X

extern const struct mb cosmos_codebase_profile_names[COSMOS_CODEBASE_PROFILE_CNT];

static inline struct mv
cosmos_codebase_profile_name (enum cosmos_codebase_profile profile)
{
  DBG_ASSERT_IN (0, profile, COSMOS_CODEBASE_PROFILE_CNT - 1, "%d", "%d", "%d");
  return mv_from_mb (cosmos_codebase_profile_names[profile]);
}

struct cosmos_codebase_config {
  struct mv    ns;
  struct mv    root;
  struct mv    include;
  struct mv    src;
  struct mv    build;
  struct mv    obj;
  struct mv    dep;
  struct mv    bin;
  struct mv    cc;
  struct mv_da cflags;
  struct mv_da ldflags;
};

extern struct cosmos_codebase_config cosmos_codebase_config;

void cosmos_codebase_configure (enum cosmos_codebase_profile, struct mv ns, struct mv root, struct mv build, struct mv cc);
void cosmos_codebase           (void);

#endif // INCLUDED_COSMOS_CODEBASE_CMK_H

// cmk.h ends here