68 lines
1.7 KiB
Markdown
68 lines
1.7 KiB
Markdown
# Building StarStruck on Windows with MinGW
|
||
|
||
## Common Issues and Solutions
|
||
|
||
### Issue 1: Makefile syntax errors with mingw32-make
|
||
The original Makefile uses Unix-style commands that don't work well with MinGW's command shell. Here's an adjusted version that should work:
|
||
|
||
```
|
||
# Adjusted Makefile for MinGW compatibility
|
||
CC := gcc
|
||
BINDIR := .
|
||
SRCDIR := src
|
||
OBJDIR := $(SRCDIR)/obj
|
||
INCDIR := $(SRCDIR)/engine
|
||
|
||
SRCS := $(wildcard $(SRCDIR)/*.c)
|
||
SRCS += $(wildcard $(SRCDIR)/engine/*.c)
|
||
SRCS += $(wildcard $(SRCDIR)/audio/*.c)
|
||
|
||
OBJS := $(SRCS:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
|
||
|
||
CFLAGS := -I$(INCDIR) -Iinclude -I$(SRCDIR)/audio
|
||
CFLAGS += -Ilib # falls Raylib‑Header dort liegen
|
||
CFLAGS += -O2 -std=c99
|
||
|
||
LDFLAGS := -Llib -lraylib
|
||
LDFLAGS += -lopengl32 -lgdi32 -lwinmm
|
||
|
||
.PHONY: all clean run
|
||
|
||
all: $(BINDIR)/stars.exe
|
||
|
||
$(BINDIR)/stars.exe: $(OBJS)
|
||
$(CC) $(OBJS) $(LDFLAGS) -o $@
|
||
|
||
$(OBJDIR)/%.o: $(SRCDIR)/%.c
|
||
@mkdir -p $(OBJDIR)
|
||
$(CC) $(CFLAGS) -c $< -o $@
|
||
|
||
$(OBJDIR)/engine/%.o: $(SRCDIR)/engine/%.c
|
||
@mkdir -p $(OBJDIR)/engine
|
||
$(CC) $(CFLAGS) -c $< -o $@
|
||
|
||
$(OBJDIR)/audio/%.o: $(SRCDIR)/audio/%.c
|
||
@mkdir -p $(OBJDIR)/audio
|
||
$(CC) $(CFLAGS) -c $< -o $@
|
||
|
||
clean:
|
||
del /Q $(OBJDIR)\*.o 2>NUL
|
||
del /Q $(BINDIR)\stars.exe 2>NUL
|
||
|
||
run: $(BINDIR)/stars.exe
|
||
$(BINDIR)/stars.exe
|
||
```
|
||
|
||
### Issue 2: Environment setup requirements
|
||
Make sure these are available in your PATH:
|
||
- GCC (MinGW-w64)
|
||
- Make (mingw32-make or mingw64-make)
|
||
- Proper Windows development libraries
|
||
|
||
To build the project:
|
||
1. Open a MinGW terminal (not PowerShell!)
|
||
2. Run `mingw32-make` or `make`
|
||
3. Then run `mingw32-make run`
|
||
|
||
### Issue 3: Working directory
|
||
Ensure you're running `make` from the project root directory where the Makefile is located. |