diff options
author | admin <contact@optics-design.com> | 2025-04-25 21:17:07 +0200 |
---|---|---|
committer | admin <contact@optics-design.com> | 2025-04-25 21:17:07 +0200 |
commit | 4b3b08ecadf8604062c7f801668e641cb024e309 (patch) | |
tree | 93614c08b9cfabff25e5c790fcfd50d31663ef53 /Makefile |
First Commit
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7fc04c4 --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +CC=gcc
+#Base Directories
+SRCDIR=src
+BINDIR=bin
+INCDIR=include
+
+#Common flags
+CFLAGS=-I$(INCDIR) -O2 -march=native -flto #-ffast-math
+
+#odutils
+OD_SRCS = $(wildcard $(SRCDIR)/odutils/*.c)
+OD_EXES = $(patsubst $(SRCDIR)/odutils/%.c, $(BINDIR)/%.exe, $(OD_SRCS))
+
+#lensdrac
+SDL2_SRCS = $(wildcard $(SRCDIR)/lensdrac/*.c)
+SDL2_EXES = $(patsubst $(SRCDIR)/lensdrac/%.c, $(BINDIR)/%.exe, $(SDL2_SRCS))
+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 odutils lensdrac sdl2 structure
+odutils: $(OD_EXES)
+$(BINDIR)/%.exe: $(SRCDIR)/odutils/%.c
+ $(CC) $< $(CFLAGS) -o $@
+
+lensdrac: $(SDL2_EXES)
+$(BINDIR)/%.exe: $(SRCDIR)/lensdrac/%.c
+ $(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 -f 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"
|