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 # Program name
PROG = emrys_emotional_simulator PROG = emrys_emotional_simulator
TEST_PROG = emrys_emotional_simulator_test
# Source files (relative to project root) # Source files
SRCS = main.c \ SRCS = src/main.c \
emotional_simulator/emotional_simulator.c \ src/MODULE_emotional_simulator/emotional_simulator.c \
emotional_simulator/internal/private_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 # Header search paths
CFLAGS += -I. CFLAGS += -I.
CFLAGS += -Iemotional_simulator CFLAGS += -Isrc
CFLAGS += -Iemotional_simulator/internal CFLAGS += -Isrc/MODULE_emotional_simulator
CFLAGS += -Isrc/MODULE_emotional_simulator/internal
# Common compiler flags (POSIX-compliant) # Common compiler flags
CFLAGS += -Wall -Wextra -std=c99 CFLAGS += -Wall -Wextra -std=c99
# Debug build (optional) # Generate object file list with proper paths
# CFLAGS += -g -DDEBUG
# Optimization (optional)
# CFLAGS += -O2
# Object files
OBJS = ${SRCS:.c=.o} OBJS = ${SRCS:.c=.o}
TEST_OBJS = ${TEST_SRCS:.c=.o}
# Default target # Default target
all: ${PROG} all: ${PROG}
# Link the program # Link the main program
${PROG}: ${OBJS} ${PROG}: ${OBJS}
${CC} ${LDFLAGS} -o ${PROG} ${OBJS} ${CC} ${LDFLAGS} -o $@ ${OBJS}
# Compile C source files to object files # Link the test program
%.o: %.c ${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 $@ ${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 build artifacts
clean: clean:
rm -f ${OBJS} ${PROG} rm -f ${OBJS} ${TEST_OBJS}
rm -f ${PROG} ${TEST_PROG}
# Dist clean (remove all generated files) # Dist clean (remove all generated files)
distclean: clean distclean: clean
@@ -53,20 +76,15 @@ install: ${PROG}
uninstall: uninstall:
rm -f ${DESTDIR}/usr/local/bin/${PROG} 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 # Show help
help: help:
@echo "Available targets:" @echo "Available targets:"
@echo " all - Build the program (default)" @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 " distclean - Remove all generated files"
@echo " install - Install to DESTDIR" @echo " install - Install to DESTDIR"
@echo " uninstall - Remove from DESTDIR" @echo " uninstall - Remove from DESTDIR"
@echo " test - Run tests" @echo " test - Run test suite"
@echo " help - Show this help" @echo " help - Show this help"
.PHONY: all clean distclean install uninstall test 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", "surprise\0",
}; };
puts("=================================================");
for(uint8_t i = 0; i < NUMBER_OF_EMOTIONS; i++) for(uint8_t i = 0; i < NUMBER_OF_EMOTIONS; i++)
{ {
puts("=================================================");
printf("| %s: %d\n", printf("| %s: %d\n",
emotions_names[i], emotions_names[i],
(int)emotion_vector_to_dump->values[i]); (int)emotion_vector_to_dump->values[i]);
puts("=================================================");
} }
puts("=================================================");
} }
void 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> #include <stdlib.h>

BIN
src/main.o Normal file

Binary file not shown.