diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6847ef1 --- /dev/null +++ b/Makefile @@ -0,0 +1,51 @@ +CC=gcc
+#Base Directories
+SRCDIR=src
+BINDIR=bin
+INCDIR=include
+
+#Common flags
+CFLAGS=-I$(INCDIR) -O2 -march=native -flto #-ffast-math
+
+#glautils
+GLA_SRCS = $(wildcard $(SRCDIR)/glautils/*.c)
+GLA_EXES = $(patsubst $(SRCDIR)/glautils/%.c, $(BINDIR)/%.exe, $(GLA_SRCS))
+#glamac
+GLAMAC_SRC = $(SRCDIR)/glamac/glamac.c \
+ $(SRCDIR)/glamac/glamac_view.c \
+ $(SRCDIR)/glamac/glamac_render.c \
+ $(SRCDIR)/glamac/glamac_events.c \
+ $(SRCDIR)/glamac/glass_data.c
+#SDL2 Stuff
+SDL2_CFLAGS=-I$(USERPROFILE)/scoop/apps/sdl2/current/include/SDl2 -I$(USERPROFILE)/scoop/apps/sdl2-ttf/current/include/SDL2_ttf -O2 -march=native -flto -ffast-math -s
+SDL2_LDFLAGS=-L$(USERPROFILE)/scoop/apps/sdl2/current/lib -L$(USERPROFILE)/scoop/apps/sdl2-ttf/current/lib -lSDL2main -lSDL2 -lSDL2_ttf -mwindows -flto
+SDL2_DLL_SRC=$(USERPROFILE)/scoop/apps/sdl2/current/lib/SDL2.dll
+SDL2_tff_DLL_SRC=$(USERPROFILE)/scoop/apps/sdl2-ttf/current/lib/SDL2_ttf.dll
+SDL2_DLL_DEST=$(BINDIR)
+
+# Setup target
+setup:
+ mkdir -p $(BINDIR) $(INCDIR)
+
+all: setup glautils glamac sdl2 structure
+
+glautils: $(GLA_EXES)
+$(BINDIR)/%.exe: $(SRCDIR)/glautils/%.c
+ $(CC) $< $(CFLAGS) -o $@
+
+glamac: $(BINDIR)/glamac.exe
+$(BINDIR)/%.exe: $(GLAMAC_SRC)
+ $(CC) $^ $(CFLAGS) $(SDL2_CFLAGS) $(SDL2_LDFLAGS) -o $@
+
+sdl2:
+ cp $(SDL2_DLL_SRC) $(SDL2_DLL_DEST)
+ cp $(SDL2_tff_DLL_SRC) $(SDL2_DLL_DEST)
+clean:
+ rm -f $(BINDIR)/*
+ rm structure.txt
+
+rebuild: clean all
+
+# Generate project structure
+structure:
+ @powershell -Command "(Get-Item .).Name | Set-Content structure.txt; (tree /a /f | Select-Object -Skip 3) | Add-Content structure.txt"
|