blob: fffe03fa964929103fa361cc38be93b9ffa8b74b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# Makefile.win - cross-compile the Windows build with mingw-w64.
#
# Links the Win32 backend instead of the Wayland one (no protocols, no
# wayland-scanner, no pkg-config). Produces a single static mouseboard.exe.
#
# make -f Makefile.win # x86_64
# make -f Makefile.win CC=i686-w64-mingw32-gcc # 32-bit
#
# Needs a mingw-w64 cross toolchain on the build host:
# Debian / Ubuntu : sudo apt install gcc-mingw-w64-x86-64
# Arch : sudo pacman -S mingw-w64-gcc
# Fedora : sudo dnf install mingw64-gcc
#
# Built for the GUI subsystem (-mwindows) so launching it - e.g. from a hotkey -
# creates no console window. The backend still calls AttachConsole() at startup,
# so --help / --dry-run / --selftest output appears when run from a terminal.
VERSION = 0-dev
# Unconditional: make predefines CC=cc, which ?= would keep, silently
# building with the host compiler. `make -f Makefile.win CC=...` still wins.
CC = x86_64-w64-mingw32-gcc
CFLAGS ?= -std=c11 -Wall -Wextra -O2
override CPPFLAGS += -DMOUSEBOARD_VERSION='"$(VERSION)"'
# -s strips at link: no symbols in the shipped exe.
MB_LDFLAGS = -static -mwindows -s
MB_LDLIBS = -lgdi32 -luser32
# Distinct object names: the Linux Makefile compiles main.o etc. with the
# host cc, and sharing names would link objects from the wrong compiler when
# switching builds without a clean.
OBJ = main.win.o core.win.o config.win.o draw.win.o font.win.o \
backend-windows.win.o
# font8x8_basic.h is vendored verbatim; its 0xFF rows overflow signed char.
font.win.o: override CFLAGS += -Wno-overflow
mouseboard.exe: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(MB_LDFLAGS) -o $@ $(OBJ) \
$(LDLIBS) $(MB_LDLIBS)
# Every object depends on every header: over-rebuilds a little, never stale.
$(OBJ): config.h core.h draw.h font.h platform.h font8x8_basic.h
%.win.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
clean:
rm -f mouseboard.exe $(OBJ)
.PHONY: clean
|