Skip to content

Commit

Permalink
Modified the Makefile to compile for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-russeil committed Mar 23, 2024
1 parent a479f9b commit cec016f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
CC = gcc
CC_WIN = i686-w64-mingw32-gcc
CFLAGS = -I ~/raylib/src -I $(INCLUDE_DIR) -L ~/raylib/release/libs/linux
LDFLAGS = -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
LDFLAGS_WIN = /usr/local/lib/libraylibwin.a -lgdi32 -lwinmm -luser32 -lm
SRC_DIR = src
OBJ_DIR = obj
INCLUDE_DIR = include
TARGET = main
TARGET = asteroids
TARGET_WIN = asteroids.exe
SOURCES = $(wildcard $(SRC_DIR)/*.c)

$(OBJ_DIR)/$(TARGET): $(SOURCES)
all: $(TARGET) $(TARGET_WIN)

$(TARGET): $(SOURCES)
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
rm -f $(SRC_DIR)/*.o

.PHONY: clean
$(TARGET_WIN): $(SOURCES)
$(CC_WIN) $(CFLAGS) $^ $(LDFLAGS_WIN) -o $@
rm -f $(SRC_DIR)/*.o

.PHONY: clean all

clean:
rm -f $(OBJ_DIR)/$(TARGET)
rm -f $(TARGET)
rm -f $(TARGET_WIN)
Binary file removed obj/main
Binary file not shown.

0 comments on commit cec016f

Please sign in to comment.