]> git.lizzy.rs Git - shadowclad.git/blobdiff - Makefile
It builds! It runs!
[shadowclad.git] / Makefile
index 28a06f246d4c087d8b212f748cf736dc21663c9c..c454140a7340440a20b7b3e523423fbf3c475eec 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,16 @@
-PLATFORM ?= x86_64-linux-gnu
+#PLATFORM ?= x86_64-linux-gnu
+PLATFORM ?= x86_64-w64-mingw32
+
+CC ::= x86_64-w64-mingw32-cc
 
 BUILDDIR ?= target/$(PLATFORM)
 SRCDIR ?= src
 
 CPPFLAGS ::= -iquotesrc/ $(CPPFLAGS)
-CFLAGS ::= -g -std=c99 -Wall -Wextra -Wpedantic $(CFLAGS)
+CFLAGS ::= -g -std=c99 -Wall -Wextra -Wpedantic -Werror \
+           -Wno-error=unused-function -Wno-error=unused-parameter $(CFLAGS)
 LDFLAGS ::= $(LDFLAGS)
-LDLIBS ::= -L/usr/local/lib -lGL -lGLEW -lglut -lassimp $(LDLIBS)
+LDLIBS ::= -L/usr/x86_64-w64-mingw32/bin -lm -lopengl32 -lglew32 -lglfw3 -lassimp $(LDLIBS)
 
 # ######
 # Paths
@@ -14,11 +18,18 @@ LDLIBS ::= -L/usr/local/lib -lGL -lGLEW -lglut -lassimp $(LDLIBS)
 
 sources ::= main.c \
             engine/asset.c \
+            engine/engine.c \
+            engine/geometry.c \
+            engine/input.c \
             engine/logger.c \
             engine/performance.c \
             engine/render.c \
+            engine/scene.c \
+            engine/string.c \
             engine/tga.c \
             engine/ui.c \
+            game/game.c \
+            game/input.c \
             game/level.c \
             game/player.c
 
@@ -34,7 +45,8 @@ depfiles ::= $(addprefix $(BUILDDIR)/, $(addsuffix .mk, $(srcfiles)))
 #else
 #      binext ::=
 #endif
-binary ::= $(BUILDDIR)/shadowclad #$(binext)
+binary ::= $(BUILDDIR)/shadowclad.exe
+#binary ::= $(BUILDDIR)/shadowclad #$(binext)
 
 # ######
 # Main build rules
@@ -43,13 +55,14 @@ binary ::= $(BUILDDIR)/shadowclad #$(binext)
 # Default rule: build executable
 $(binary): $(objects)
        @mkdir -p $(@D)
-       @echo "###### Linking executable..."
+       @echo "Linking executable"
        $(CC) $(LDFLAGS) -o $(binary) $^ $(LOADLIBES) $(LDLIBS)
 
 # Build C translation units
 $(objects): $(BUILDDIR)/%.c.o: %.c $(BUILDDIR)/%.c.mk
        @mkdir -p $(@D)
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+       @echo "Building $@"
+       @$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
 
 # ######
 # Setup
@@ -57,7 +70,8 @@ $(objects): $(BUILDDIR)/%.c.o: %.c $(BUILDDIR)/%.c.mk
 
 # Initialise build environment
 init:
-       mkdir -p $(BUILDDIR)
+       @echo "Creating build directory $(BUILDDIR)"
+       @mkdir -p $(BUILDDIR)
 .PHONY: init
 
 # ######
@@ -67,7 +81,7 @@ init:
 # Build and run
 run: $(binary)
        @echo
-       @LD_LIBRARY_PATH=/usr/local/lib $(binary)
+       @$(binary)
 .PHONY: run
 
 # Build executable
@@ -98,5 +112,6 @@ include $(foreach depfile, $(depfiles), $(shell [ -r "$(depfile)" ] && echo "$(d
 # ######
 
 clean:
-       rm -rf $(BUILDDIR)
+       @echo "Removing $(BUILDDIR)"
+       @rm -rf $(BUILDDIR)
 .PHONY: clean