-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (37 loc) · 896 Bytes
/
Makefile
File metadata and controls
49 lines (37 loc) · 896 Bytes
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
CC = clang
CFLAGS = -m64 -std=c11 -Isrc
DEBUG_CFLAGS = -DDEBUG -g -O0 -fsanitize=address
RELEASE_CFLAGS = -DNDEBUG -O2
CFLAGS += -Wall -Wextra -pedantic -Wconversion
CFLAGS += -Wno-gnu-binary-literal -Wno-c23-extensions
config ?= debug
ifeq ($(config), debug)
CFLAGS += $(DEBUG_CFLAGS)
else
CFLAGS += $(RELEASE_CFLAGS)
endif
# OS-Specific Stuff
LFLAGS =
MKDIR_BIN =
RM_BIN =
BIN_EXT =
ifeq ($(OS), Windows_NT)
LFLAGS += -lgdi32 -lkernel32 -luser32 -lBcrypt
MKDIR_BIN = if not exist bin\$(config) mkdir bin\$(config)
RM_BIN = rd /s /q bin
BIN_EXT = .exe
else
CFLAGS += -D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE
LFLAGS += -lm
MKDIR_BIN = mkdir -p bin/$(config)
RM_BIN = rm -r bin
endif
SRC_DIR = src
BIN = bin/$(config)/nscim
all: nscim
nscim:
@$(MKDIR_BIN)
$(CC) $(SRC_DIR)/main.c $(CFLAGS) $(LFLAGS) -o $(BIN)$(BIN_EXT)
clean:
$(RM_BIN)
.PHONY: all nscim clean