Refactor: modularize code into separate files with enhanced documentation
- Split paula.cpp and modplayer.cpp into separate compilation units - Created config.h for centralized configuration constants - Created types.h for type definitions and utility functions - Added comprehensive comments throughout all files - Improved code organization with clear section dividers - Maintained all original functionality and logic
This commit is contained in:
@@ -1,10 +1,40 @@
|
||||
## build TinyMOD
|
||||
## jbs - paragonsoft
|
||||
# =================== TinyMOD Makefile ===================
|
||||
# Build configuration for TinyMOD MOD player
|
||||
|
||||
all: tinymod
|
||||
# === Compiler Settings ===
|
||||
CC = g++
|
||||
CFLAGS = -O2 -Wall -Wextra
|
||||
|
||||
tinymod: tinymod.cpp
|
||||
## g++ -o tinymod tinymod.cpp
|
||||
g++ -o tinymod `pkg-config --libs alsa` tinymod.cpp -lm -L . -l:libportaudio.a
|
||||
# === Source Files ===
|
||||
SOURCES = src/main.cpp src/paula.cpp src/modplayer.cpp
|
||||
OBJECTS = $(SOURCES:.cpp=.o)
|
||||
TARGET = tinymod
|
||||
|
||||
# === Libraries ===
|
||||
# PortAudio library (static link)
|
||||
LIBS = -L. -l:libportaudio.a -lm
|
||||
|
||||
# === PortAudio Configuration ===
|
||||
# Optional: link with ALSA for Linux
|
||||
PORTAUDIO_LIBS = $(shell pkg-config --libs alsa 2>/dev/null)
|
||||
LIBS += $(PORTAUDIO_LIBS)
|
||||
|
||||
# === Build Rules ===
|
||||
all: $(TARGET)
|
||||
|
||||
# Link object files to create executable
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(CC) -o $@ $^ $(LIBS)
|
||||
@echo "Build complete: $(TARGET)"
|
||||
|
||||
# Compile source files to object files
|
||||
src/%.o: src/%.cpp
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
rm tinymod
|
||||
rm -f $(OBJECTS) $(TARGET)
|
||||
@echo "Clean complete"
|
||||
|
||||
# Phony targets (not actual files)
|
||||
.PHONY: all clean
|
||||
|
||||
Reference in New Issue
Block a user