aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-26 09:10:38 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-26 09:11:35 +0200
commit3e3d8d6c13e6b4207a97aee117236b8ca70b9fbe (patch)
tree2c89e0f343d40280d0b1f715b10d4591e21725fc /Makefile
parenteb7709d8617bec27349eebb43e8941b3aaaf453e (diff)
downloadEpisodeBrowser-3e3d8d6c13e6b4207a97aee117236b8ca70b9fbe.tar.gz
Use CMake.
I don't love it, but it makes it possible to support Visual Studio in addition to MinGW GCC.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile76
1 files changed, 23 insertions, 53 deletions
diff --git a/Makefile b/Makefile
index 50f5e00..f6d8bee 100644
--- a/Makefile
+++ b/Makefile
@@ -1,61 +1,31 @@
-EXE = EpisodeBrowser.exe
+SYSTEM ?= vs2019
-OBJ = b/datalistview.obj
-OBJ += b/data.obj
-OBJ += b/debug.obj
-OBJ += b/episodelistview.obj
-OBJ += b/ext.obj
-OBJ += b/layout.obj
-OBJ += b/listview.obj
-OBJ += b/main.obj
-OBJ += b/resource.obj
-OBJ += b/test.obj
-OBJ += b/win.obj
+EXE = b/$(SYSTEM)/EpisodeBrowser.exe
+ifneq ($(SYSTEM), mingw)
+EXE = b/$(SYSTEM)/Debug/EpisodeBrowser.exe
+endif
-CC = gcc
-CFLAGS = -DUNICODE -D_UNICODE
-CFLAGS += -D_DEBUG
-CFLAGS += -std=c++17 -mwindows -O0
-CFLAGS += -IC:/msys64/mingw64/include/libxml2
-CFLAGS += -Wall -Wextra -Wpedantic -Wno-missing-field-initializers -Wno-parentheses
-LDFLAGS += -lstdc++ -lcomctl32 -lwininet -llibxml2
-
-all: showdeps b/$(EXE)
- cp b/$(EXE) "C:\Users\John\Desktop\Delat"
+all:
+ cd b/$(SYSTEM) && cmake --build . -j
+ifneq ($(SYSTEM), mingw)
+ cp x/l/libxml2.dll b/$(SYSTEM)/Debug
+endif
+ cp $(EXE) "C:\Users\John\Desktop\Delat"
clean:
- rm -fr b/$(EXE) b/*.obj
+ cd b/$(SYSTEM) && cmake --build . --target clean
TAGS: c/*.cpp c/*.h
etags --declarations -lc++ c/*.cpp c/*.h
-b/$(EXE): Makefile $(OBJ)
- $(CC) $(CFLAGS) -o $@ $(OBJ) $(LDFLAGS)
-
-b/resource.obj: c/resource.h c/resource.rc c/application.manifest
- windres -i c/resource.rc -o b/resource.obj
-
-b/%.obj: c/%.cpp
- $(CC) -c $(CFLAGS) -o $@ $<
-
-s/%.s: c/%.cpp
- $(CC) $(CFLAGS) -fverbose-asm -masm=intel -S -o $@ $<
-
-# showdeps prints a short summary of which dependencies have changed,
-# causing which targets to be rebuilt. It is run by the `all' target
-# by default.
-.PHONY: showdeps
-showdeps:
- @perl showdeps
-
-# showdeps prints all TODO comments in the C++ source files.
-.PHONY: showtodo
-showtodo:
- @perl showtodo
-
-# deps.mk includes additional, dynamically generated dependencies for
-# b/*.obj and b/EpisodeBrowser.exe. Because it is included below, GNU
-# make should build deps.mk automatically.
-deps.mk: c/*.cpp
- @perl makedeps
--include deps.mk
+.PHONY: mingw vs2019
+b:
+ mkdir b
+b/mingw: b
+ mkdir b/mingw
+b/vs2019: b
+ mkdir b/vs2019
+mingw: b/mingw
+ cd b/mingw && cmake -G "Unix Makefiles" ../../c
+vs2019: b/vs2019
+ cd b/vs2019 && cmake -G "Visual Studio 16 2019" ../../c