-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
145 lines (123 loc) · 4.66 KB
/
Copy pathMakefile
File metadata and controls
145 lines (123 loc) · 4.66 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Compiler and flags
CC = gcc
CFLAGS = -Wall -Wextra -std=c99 -O2
LIBS = -lmingw32 -lSDL2main -lSDL2 -lm
# Python integration for MSYS2/MinGW64
PYTHON_VERSION = 3.12
PYTHON_INCLUDE = -I/mingw64/include/python$(PYTHON_VERSION)
PYTHON_LIBS = -L/mingw64/lib -lpython$(PYTHON_VERSION)
# Directories
SRCDIR = src
INCDIR = include
OBJDIR = obj
# Target executable
TARGET = main.exe
# Source files
SOURCES = $(wildcard $(SRCDIR)/*.c)
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
# Include path
INCLUDES = -I$(INCDIR) $(PYTHON_INCLUDE)
# Complete library list
ALL_LIBS = $(LIBS) $(PYTHON_LIBS)
# Default target
all: check-python $(TARGET)
# Python environment check
check-python:
@echo "Checking Python installation..."
@python --version
@echo "Testing Python modules..."
@python -c "import math, random; print('✓ Basic modules work')"
@echo "Checking Python headers..."
@test -f /mingw64/include/python$(PYTHON_VERSION)/Python.h && echo "✓ Python headers found" || echo "⚠ Python headers missing"
# Create object directory
$(OBJDIR):
@mkdir -p $(OBJDIR)
# Build target executable
$(TARGET): $(OBJDIR) $(OBJECTS)
@echo "Linking executable..."
$(CC) $(OBJECTS) -o $(TARGET) $(ALL_LIBS)
@echo "✓ Build complete: $(TARGET)"
# Compile source files to object files
$(OBJDIR)/%.o: $(SRCDIR)/%.c
@echo "Compiling $<..."
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
# Clean build files
clean:
@echo "Cleaning build files..."
rm -rf $(OBJDIR) $(TARGET)
# Rebuild everything
rebuild: clean all
# Debug build with debug symbols
debug: CFLAGS += -g -DDEBUG
debug: $(TARGET)
# Install Python development headers
install-python-headers:
@echo "Installing Python development headers..."
@if ! test -f /mingw64/include/python$(PYTHON_VERSION)/Python.h; then \
echo "Python headers not found, installing..."; \
pacman -S --needed mingw-w64-x86_64-python; \
else \
echo "✓ Python headers already installed"; \
fi
# Install all dependencies
install-deps:
@echo "Installing dependencies for MSYS2/MinGW64..."
pacman -S --needed --noconfirm \
mingw-w64-x86_64-SDL2 \
mingw-w64-x86_64-python \
mingw-w64-x86_64-python-pip
# Build without Python check (if having issues)
build-no-check: $(TARGET)
# Run the program
run: $(TARGET)
@echo "Starting marine ecosystem simulation..."
./$(TARGET)
# Test ecosystem statistics monitor
test-stats:
@echo "Testing ecosystem statistics monitor..."
@if [ -f ecosystem_stats.py ]; then \
python ecosystem_stats.py; \
else \
echo "Error: ecosystem_stats.py not found"; \
fi
# Check Python dependencies for statistics
check-stats-deps:
@echo "Checking ecosystem statistics dependencies..."
@python -c "import tkinter; print('✓ tkinter available')" || echo "✗ tkinter missing"
@python -c "import threading; print('✓ threading available')" || echo "✗ threading missing"
@python -c "import time; print('✓ time available')" || echo "✗ time missing"
@python -c "import struct; print('✓ struct available')" || echo "✗ struct missing"
@python -c "import os; print('✓ os available')" || echo "✗ os missing"
@python -c "import collections; print('✓ collections available')" || echo "✗ collections missing"
@echo "All dependencies use Python standard library only"
# Show help
help:
@echo "Marine Ecosystem Simulation - Build Targets:"
@echo ""
@echo "Build Targets:"
@echo " all - Build with Python check (default)"
@echo " build-no-check - Build without Python check"
@echo " clean - Remove build files"
@echo " rebuild - Clean and build"
@echo " debug - Build with debug symbols"
@echo ""
@echo "Runtime Targets:"
@echo " run - Build and run the program"
@echo " test-stats - Test ecosystem statistics monitor"
@echo ""
@echo "Setup Targets:"
@echo " install-deps - Install dependencies"
@echo " install-python-headers - Install Python development files"
@echo " check-stats-deps - Check statistics dependencies"
@echo " help - Show this help"
@echo ""
@echo "Simulation Features:"
@echo " • Press 'TAB' in simulation to open statistics window"
@echo " • Temperature control: 0.0°C to 3.0°C (0.1°C precision)"
@echo " • Coral bleaching occurs at temperatures > 0°C"
@echo " • Higher temperatures increase bleaching probability"
@echo " • Bleached corals appear white/gray and produce no oxygen"
@echo " • Temperature affects entire coral colonies (nodes + chains)"
@echo " • Live monitoring shows ecosystem metrics in real-time"
@echo " • Neural network integration for AI fish behavior"
.PHONY: all build-no-check clean rebuild debug install-deps run test-stats check-stats-deps help check-python install-python-headers