-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (69 loc) · 2.15 KB
/
Makefile
File metadata and controls
84 lines (69 loc) · 2.15 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Compiler and flags
CC = gcc
CFLAGS = -Wall -Wextra -g -Iinclude `pkg-config --cflags gtk+-3.0`
LDFLAGS = `pkg-config --libs gtk+-3.0` -lsqlite3 -lcrypto -lm
# Directories
SRC_DIR = src
BUILD_DIR = build
INCLUDE_DIR = include
DATA_DIR = data
# Source files
SOURCES = $(wildcard $(SRC_DIR)/*.c)
OBJECTS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SOURCES))
# Resource files
RC_FILE = app.rc
RES_FILE = $(BUILD_DIR)/app.res
# Target executable
TARGET = $(BUILD_DIR)/assignment_tracker.exe
# Default target
all: $(BUILD_DIR) $(DATA_DIR) $(TARGET)
# Compile resource file
$(RES_FILE): $(RC_FILE) | $(BUILD_DIR)
@echo "Compiling resource file..."
windres $(RC_FILE) -O coff -o $(RES_FILE)
# Link object files to create executable
$(TARGET): $(OBJECTS) $(RES_FILE)
@echo "Linking executable..."
$(CC) $(OBJECTS) $(RES_FILE) -o $(TARGET) $(LDFLAGS)
@echo "========================================="
@echo "Build complete: $(TARGET)"
@echo "Run with: make run"
@echo "========================================="
# Compile source files to object files
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c | $(BUILD_DIR)
@echo "Compiling $<..."
$(CC) $(CFLAGS) -c $< -o $@
# Create build directory if it doesn't exist
$(BUILD_DIR):
@echo "Creating build directory..."
@mkdir -p $(BUILD_DIR)
# Create data directory if it doesn't exist
$(DATA_DIR):
@echo "Creating data directory..."
@mkdir -p $(DATA_DIR)
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -rf $(BUILD_DIR)/*.o $(TARGET)
@echo "Clean complete"
# Run the application
run: $(TARGET)
@echo "Starting Assignment Tracker..."
@$(TARGET)
# Rebuild everything
rebuild: clean all
# Show help
help:
@echo "Assignment Tracker - Makefile targets:"
@echo " make all - Build the project (default)"
@echo " make clean - Remove build artifacts"
@echo " make run - Build and run the application"
@echo " make rebuild - Clean and rebuild everything"
@echo " make help - Show this help message"
@echo ""
@echo "Build configuration:"
@echo " Compiler: $(CC)"
@echo " Source dir: $(SRC_DIR)"
@echo " Build dir: $(BUILD_DIR)"
@echo " Target: $(TARGET)"
.PHONY: all clean run rebuild help