added bmake file (Makefile)

This commit is contained in:
2026-03-13 10:26:00 -05:00
parent 8c86bd2a3e
commit 70bd676539
7 changed files with 47 additions and 30 deletions

View File

@@ -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

BIN
emrys_emotional_simulator Executable file

Binary file not shown.

View File

@@ -72,15 +72,14 @@ dump_emotion_vector_values(struct emotion_vector_struct* emotion_vector_to_dump)
"surprise\0",
};
puts("=================================================");
for(uint8_t i = 0; i < NUMBER_OF_EMOTIONS; i++)
{
puts("=================================================");
printf("| %s: %d\n",
emotions_names[i],
(int)emotion_vector_to_dump->values[i]);
puts("=================================================");
}
puts("=================================================");
}
void

Binary file not shown.

View File

@@ -1,5 +1,5 @@
#include "emotional_simulator/emotional_simulator.h"
#include "MODULE_emotional_simulator/emotional_simulator.h"
#include <stdlib.h>

BIN
src/main.o Normal file

Binary file not shown.