-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (49 loc) · 1.64 KB
/
Makefile
File metadata and controls
62 lines (49 loc) · 1.64 KB
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
# Nore Compiler Makefile
# Compiler
CC = clang
# Compiler flags for release build
CFLAGS = -std=c99 # Use C99 standard for maximum portability
CFLAGS += -Wall # Enable all common warning messages
CFLAGS += -Wextra # Enable additional warning messages beyond -Wall
CFLAGS += -Werror # Treat all warnings as errors (ensures clean code)
CFLAGS += -pedantic # Strict ISO C compliance, reject extensions
CFLAGS += -O2 # Optimization level 2 (good balance of speed and compile time)
# Compiler flags for debug build
DEBUGFLAGS = -std=c99 # Use C99 standard
DEBUGFLAGS += -Wall # Enable all common warnings
DEBUGFLAGS += -Wextra # Enable extra warnings
DEBUGFLAGS += -g # Include debug symbols for debuggers (gdb, lldb)
DEBUGFLAGS += -O0 # Disable optimizations for accurate debugging
TARGET = nore
SOURCE = nore.c
# Default target
all: $(TARGET)
# Build the compiler
$(TARGET): $(SOURCE)
$(CC) $(CFLAGS) -o $(TARGET) $(SOURCE)
# Debug build
debug: $(SOURCE)
$(CC) $(DEBUGFLAGS) -o $(TARGET) $(SOURCE)
# Clean build artifacts
clean:
rm -f $(TARGET)
# Run error code tests
test-errors: $(TARGET)
@chmod +x tests/run_error_tests.sh
@./tests/run_error_tests.sh
# Run success tests
test-success: $(TARGET)
@chmod +x tests/run_success_tests.sh
@./tests/run_success_tests.sh
# Run all tests
test: $(TARGET)
@chmod +x tests/run_error_tests.sh tests/run_success_tests.sh
@./tests/run_error_tests.sh
@echo ""
@./tests/run_success_tests.sh
# Run stdlib tests only
test-std: $(TARGET)
@chmod +x tests/run_std_tests.sh
@./tests/run_std_tests.sh
# Phony targets
.PHONY: all debug clean test-errors test-success test-std test