# Makefile for Cordle - Cross-platform C90 Wordle Game # Supports Unix/Linux/macOS and DOS (DJGPP) # # Usage: # Unix/Linux/macOS: make # DOS (DJGPP): make # Clean: make clean # Compiler CC = gcc # Compiler flags - strict C90 compliance CFLAGS = -std=c90 -Wall -Wextra -pedantic -O2 # Source files SRC = cordle.c OBJ = cordle.o # Platform detection and configuration # Check for DOS/Windows environment ifdef COMSPEC # DOS/Windows detected PLATFORM = DOS TARGET = cordle.exe CURSES_LIB = -lpdcurses RM = del /Q RMDIR = rmdir /S /Q PATHSEP = \\ # DOS-specific flags CFLAGS += -DMSDOS else ifdef ComSpec # Alternative Windows detection PLATFORM = DOS TARGET = cordle.exe CURSES_LIB = -lpdcurses RM = del /Q RMDIR = rmdir /S /Q PATHSEP = \\ CFLAGS += -DMSDOS else # Unix/Linux/macOS PLATFORM = UNIX TARGET = cordle CURSES_LIB = -lncurses RM = rm -f RMDIR = rm -rf PATHSEP = / endif endif # Additional libraries LIBS = $(CURSES_LIB) # Phony targets .PHONY: all clean help info # Default target all: info $(TARGET) # Display build information info: @echo ============================================ @echo Building Cordle for $(PLATFORM) @echo Compiler: $(CC) @echo Flags: $(CFLAGS) @echo Libraries: $(LIBS) @echo ============================================ @echo # Build target $(TARGET): $(SRC) $(CC) $(CFLAGS) -o $(TARGET) $(SRC) $(LIBS) @echo @echo ============================================ @echo Build complete: $(TARGET) @echo ============================================ @echo @echo To run: ./$(TARGET) --help @echo # Object file (alternative build method) $(OBJ): $(SRC) $(CC) $(CFLAGS) -c $(SRC) # Clean build artifacts clean: @echo Cleaning build artifacts... $(RM) $(TARGET) $(OBJ) @echo Clean complete. # Help target help: @echo Cordle Makefile - Build Instructions @echo ===================================== @echo @echo Targets: @echo make - Build the game @echo make clean - Remove build artifacts @echo make help - Show this help message @echo make info - Show build configuration @echo @echo Platform Detection: @echo Current: $(PLATFORM) @echo @echo DOS/DJGPP Requirements: @echo - DJGPP compiler installed @echo - PDCurses library installed @echo - Make utility available @echo @echo Unix/Linux/macOS Requirements: @echo - GCC compiler @echo - ncurses library @echo - Make utility @echo @echo Game Options: @echo ./$(TARGET) --easy Easy difficulty @echo ./$(TARGET) --medium Medium difficulty @echo ./$(TARGET) --hard Hard difficulty @echo ./$(TARGET) --techy Technical words @echo ./$(TARGET) --literary Literary words @echo ./$(TARGET) --cultural Cultural words @echo ./$(TARGET) --full Full dictionary @echo ./$(TARGET) --help Show game help