added bmake file (Makefile)
This commit is contained in:
70
Makefile
70
Makefile
@@ -3,43 +3,66 @@
|
||||
|
||||
# Program name
|
||||
PROG = emrys_emotional_simulator
|
||||
TEST_PROG = emrys_emotional_simulator_test
|
||||
|
||||
# Source files (relative to project root)
|
||||
SRCS = main.c \
|
||||
emotional_simulator/emotional_simulator.c \
|
||||
emotional_simulator/internal/private_emotional_simulator.c
|
||||
# Source files
|
||||
SRCS = src/main.c \
|
||||
src/MODULE_emotional_simulator/emotional_simulator.c \
|
||||
src/MODULE_emotional_simulator/internal/private_emotional_simulator.c
|
||||
|
||||
# Test source files
|
||||
TEST_SRCS = src/main_test.c \
|
||||
src/MODULE_emotional_simulator/tests/test_emotional_simulator.c
|
||||
|
||||
# Header search paths
|
||||
CFLAGS += -I.
|
||||
CFLAGS += -Iemotional_simulator
|
||||
CFLAGS += -Iemotional_simulator/internal
|
||||
CFLAGS += -Isrc
|
||||
CFLAGS += -Isrc/MODULE_emotional_simulator
|
||||
CFLAGS += -Isrc/MODULE_emotional_simulator/internal
|
||||
|
||||
# Common compiler flags (POSIX-compliant)
|
||||
# Common compiler flags
|
||||
CFLAGS += -Wall -Wextra -std=c99
|
||||
|
||||
# Debug build (optional)
|
||||
# CFLAGS += -g -DDEBUG
|
||||
|
||||
# Optimization (optional)
|
||||
# CFLAGS += -O2
|
||||
|
||||
# Object files
|
||||
# Generate object file list with proper paths
|
||||
OBJS = ${SRCS:.c=.o}
|
||||
TEST_OBJS = ${TEST_SRCS:.c=.o}
|
||||
|
||||
# Default target
|
||||
all: ${PROG}
|
||||
|
||||
# Link the program
|
||||
# Link the main program
|
||||
${PROG}: ${OBJS}
|
||||
${CC} ${LDFLAGS} -o ${PROG} ${OBJS}
|
||||
${CC} ${LDFLAGS} -o $@ ${OBJS}
|
||||
|
||||
# Compile C source files to object files
|
||||
%.o: %.c
|
||||
# Link the test program
|
||||
${TEST_PROG}: ${TEST_OBJS}
|
||||
${CC} ${LDFLAGS} -o $@ ${TEST_OBJS}
|
||||
|
||||
# Explicit rules for each source file to ensure .o goes with .c
|
||||
src/main.o: src/main.c
|
||||
${CC} ${CFLAGS} -c $< -o $@
|
||||
|
||||
src/MODULE_emotional_simulator/emotional_simulator.o: src/MODULE_emotional_simulator/emotional_simulator.c
|
||||
${CC} ${CFLAGS} -c $< -o $@
|
||||
|
||||
src/MODULE_emotional_simulator/internal/private_emotional_simulator.o: src/MODULE_emotional_simulator/internal/private_emotional_simulator.c
|
||||
${CC} ${CFLAGS} -c $< -o $@
|
||||
|
||||
src/main_test.o: src/main_test.c
|
||||
${CC} ${CFLAGS} -c $< -o $@
|
||||
|
||||
src/MODULE_emotional_simulator/tests/test_emotional_simulator.o: src/MODULE_emotional_simulator/tests/test_emotional_simulator.c
|
||||
${CC} ${CFLAGS} -c $< -o $@
|
||||
|
||||
# Run tests
|
||||
test: ${TEST_PROG}
|
||||
@echo "Running tests..."
|
||||
./${TEST_PROG}
|
||||
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
rm -f ${OBJS} ${PROG}
|
||||
rm -f ${OBJS} ${TEST_OBJS}
|
||||
rm -f ${PROG} ${TEST_PROG}
|
||||
|
||||
# Dist clean (remove all generated files)
|
||||
distclean: clean
|
||||
@@ -53,20 +76,15 @@ install: ${PROG}
|
||||
uninstall:
|
||||
rm -f ${DESTDIR}/usr/local/bin/${PROG}
|
||||
|
||||
# Run tests (if tests exist)
|
||||
test: ${PROG}
|
||||
@echo "Running tests..."
|
||||
@# Add test commands here when tests are implemented
|
||||
|
||||
# Show help
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " all - Build the program (default)"
|
||||
@echo " clean - Remove object files and binary"
|
||||
@echo " clean - Remove object files and binaries"
|
||||
@echo " distclean - Remove all generated files"
|
||||
@echo " install - Install to DESTDIR"
|
||||
@echo " uninstall - Remove from DESTDIR"
|
||||
@echo " test - Run tests"
|
||||
@echo " test - Run test suite"
|
||||
@echo " help - Show this help"
|
||||
|
||||
.PHONY: all clean distclean install uninstall test help
|
||||
|
||||
Reference in New Issue
Block a user