]> git.lizzy.rs Git - shadowclad.git/blobdiff - Makefile
Make warnings errors, suppress more build commands
[shadowclad.git] / Makefile
index e6e297c45412bec95c2613c438abce1a6e02a1fd..2d28f78d95078f1cebe7077d9d6626be41a6b74c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,8 @@ PLATFORM ?= x86_64-linux-gnu
 BUILDDIR ?= target/$(PLATFORM)
 SRCDIR ?= src
 
-CFLAGS ::= -g -std=c99 -Wall -Wextra -Wpedantic $(CFLAGS)
+CPPFLAGS ::= -iquotesrc/ $(CPPFLAGS)
+CFLAGS ::= -g -std=c99 -Wall -Wextra -Wpedantic -Werror $(CFLAGS)
 LDFLAGS ::= $(LDFLAGS)
 LDLIBS ::= -L/usr/local/lib -lGL -lGLEW -lglut -lassimp $(LDLIBS)
 
@@ -12,14 +13,14 @@ LDLIBS ::= -L/usr/local/lib -lGL -lGLEW -lglut -lassimp $(LDLIBS)
 # ######
 
 sources ::= main.c \
-            asset.c \
-            level.c \
-            logger.c \
-            performance.c \
-            player.c \
-            render.c \
-            tga.c \
-            ui.c
+            engine/asset.c \
+            engine/logger.c \
+            engine/performance.c \
+            engine/render.c \
+            engine/tga.c \
+            engine/ui.c \
+            game/level.c \
+            game/player.c
 
 srcfiles ::= $(addprefix $(SRCDIR)/, $(sources))
 
@@ -42,13 +43,14 @@ binary ::= $(BUILDDIR)/shadowclad #$(binext)
 # Default rule: build executable
 $(binary): $(objects)
        @mkdir -p $(@D)
-       @echo "###### Linking executable..."
-       $(CC) $(LDFLAGS) -o $(binary) $^ $(LOADLIBES) $(LDLIBS)
+       @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
@@ -56,7 +58,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
 
 # ######
@@ -97,5 +100,6 @@ include $(foreach depfile, $(depfiles), $(shell [ -r "$(depfile)" ] && echo "$(d
 # ######
 
 clean:
-       rm -rf $(BUILDDIR)
+       @echo "Removing $(BUILDDIR)"
+       @rm -rf $(BUILDDIR)
 .PHONY: clean