summaryrefslogtreecommitdiff
path: root/third_party/mcpc/mk/ccdefs-linux.mk
blob: b59540abd7bb00c5dfa7742c3fc0ee2d9fed4e0e (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
ifneq (,$(and $(isnot_done_ccdefs),$(is_linux)))
  is_unix = xxx
  is_unixar = xxx
  CFLAGS += -Dis_unix

  cc_ver = $(shell $(CC) --version)
  ifneq (,$(findstring Free Software Foundation,$(cc_ver)))
      found_gcc = xxx
  endif
  ifneq (,$(findstring clang,$(cc_ver)))
      found_clang = xxx
  endif

  ifneq (,$(found_gcc))
    is_gcc = xxx
    is_gcclike = xxx
    gcc_ver = $(shell $(CC) --version)
    is_gcc10 = $(findstring 10.,$(gcc_ver))
    is_gcc12 = $(findstring 12.,$(gcc_ver))
    is_gcc13 = $(findstring 13.,$(gcc_ver))
    is_gcc14 = $(findstring 14.,$(gcc_ver))
  else ifneq (,$(found_clang))
    is_clang = xxx
    is_gcclike = xxx
    clang_ver = $(shell $(CC) --version)
    is_clang18 = $(findstring 18.,$(clang_ver))
    is_clang19 = $(findstring 19.,$(clang_ver))
  endif

  ldd_ver = $(shell ldd --version)
  is_glibc231 = $(and $(findstring Free Software Foundation,$(ldd_ver)),$(findstring 2.31,$(ldd_ver)))
  is_glibc236 = $(and $(findstring Free Software Foundation,$(ldd_ver)),$(findstring 2.36,$(ldd_ver)))
  is_glibc240 = $(and $(findstring Free Software Foundation,$(ldd_ver)),$(findstring 2.40,$(ldd_ver)))
  is_cygwin = $(and $(findstring cygwin,$(ldd_ver)))

  ifeq (1,2)
  else ifneq (,$(and $(is_gcc10),$(is_glibc231)))
    # deb11
    CFLAGS += -std=c17
    CFLAGS += -DMCPC_C23PTCH_KW1
    CFLAGS += -DMCPC_C23PTCH_CKD1
    CFLAGS += -DMCPC_C23PTCH_UCHAR1
    CFLAGS += -DMCPC_C23GIVUP_FIXENUM
    is_manual_pthread = xxx
    isnot_done_ccdefs =
  else ifneq (,$(and $(is_gcc12),$(is_glibc236)))
    # deb12
    CFLAGS += -std=c17
    CFLAGS += -DMCPC_C23PTCH_KW1
    CFLAGS += -DMCPC_C23PTCH_CKD1
    CFLAGS += -DMCPC_C23PTCH_UCHAR1
    CFLAGS += -DMCPC_C23GIVUP_FIXENUM
    isnot_done_ccdefs =
  else ifneq (,$(and $(is_gcc14),$(is_cygwin)))
    # fc41
    CFLAGS += -std=c23
    CFLAGS += -DMCPC_C23PTCH_UCHAR1
    isnot_done_ccdefs =
  else ifneq (,$(and $(is_gcc14),$(is_mingw)))
    # fc41
    CFLAGS += -std=c233
    isnot_done_ccdefs =
  else ifneq (,$(and $(is_gcc14),$(is_glibc240)))
    # fc41
    CFLAGS += -std=c23
    isnot_done_ccdefs =
  else ifneq (,$(and $(is_clang18),$(is_glibc240)))
    # fc41
    CFLAGS += -std=c23
    isnot_done_ccdefs =
  else ifneq (,$(and $(is_clang19),$(is_glibc240)))
    # fc41
    CFLAGS += -std=c23
    isnot_done_ccdefs =
  endif



endif