commit e2f8cb4
uint
·
2026-10-03 14:41:15 +0000 UTC
parent a255bf5
Remove Make based build options, add manual build notice to README
D
Makefile
+0,
-83
1@@ -1,83 +0,0 @@
2-.POSIX:
3-
4-include config.mk
5-
6-CC = cc
7-AR = ar
8-ARFLAGS = -r -c
9-CFLAGS = -ansi -pedantic-errors -Wall -Wextra -O2
10-WL_CFLAGS = -std=c99 -Wall -Wextra -O2
11-CPPFLAGS = ${CONF_CPPFLAGS} -Iinclude -Ibuild
12-LDFLAGS = ${CONF_LDFLAGS}
13-
14-LIB_NAME = build/${CONF_LIB_NAME}
15-LIB_SRCS = source/maus.c \
16- source/maus_font.c \
17- source/utils.c \
18- ${CONF_SRC}
19-LIB_OBJS = build/maus.o \
20- build/maus_font.o \
21- build/utils.o \
22- ${CONF_OBJS}
23-
24-all: ${LIB_NAME}
25-
26-${LIB_NAME}: ${LIB_OBJS}
27- ${AR} ${ARFLAGS} $@ ${LIB_OBJS}
28-
29-build/maus.o: source/maus.c include/maus.h config.mk
30- mkdir -p build
31- ${CC} ${CFLAGS} ${CPPFLAGS} -c source/maus.c -o $@
32-build/maus_font.o: source/maus_font.c include/maus.h include/maus_font.h config.mk
33- mkdir -p build
34- ${CC} ${CFLAGS} ${CPPFLAGS} -c source/maus_font.c -o $@
35-build/utils.o: source/utils.c include/utils.h
36- mkdir -p build
37- ${CC} ${CFLAGS} ${CPPFLAGS} -c source/utils.c -o $@
38-
39-# X11
40-build/maus_x11.o: source/maus_x11.c include/maus.h include/maus_x11.h config.mk
41- mkdir -p build
42- ${CC} ${CFLAGS} ${CPPFLAGS} -c source/maus_x11.c -o $@
43-
44-# Wayland
45-build/maus_wayland.o: source/maus_wayland.c include/maus.h include/maus_wayland.h build/xdg-shell-client-protocol.h build/pointer-constraints-unstable-v1-client-protocol.h build/relative-pointer-unstable-v1-client-protocol.h config.mk
46- mkdir -p build
47- ${CC} ${WL_CFLAGS} ${CPPFLAGS} -c source/maus_wayland.c -o $@
48-build/xdg-shell-client-protocol.h:
49- mkdir -p build
50- wayland-scanner client-header ${PROTOS}/stable/xdg-shell/xdg-shell.xml $@
51-build/xdg-shell-protocol.c:
52- mkdir -p build
53- wayland-scanner private-code ${PROTOS}/stable/xdg-shell/xdg-shell.xml $@
54-build/xdg-shell-protocol.o: build/xdg-shell-protocol.c build/xdg-shell-client-protocol.h
55- mkdir -p build
56- ${CC} ${WL_CFLAGS} ${CPPFLAGS} -c build/xdg-shell-protocol.c -o $@
57-build/pointer-constraints-unstable-v1-client-protocol.h:
58- mkdir -p build
59- wayland-scanner client-header ${PROTOS}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
60-build/pointer-constraints-unstable-v1-protocol.c:
61- mkdir -p build
62- wayland-scanner private-code ${PROTOS}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
63-build/pointer-constraints-unstable-v1-protocol.o: build/pointer-constraints-unstable-v1-protocol.c build/pointer-constraints-unstable-v1-client-protocol.h
64- mkdir -p build
65- ${CC} ${WL_CFLAGS} ${CPPFLAGS} -c build/pointer-constraints-unstable-v1-protocol.c -o $@
66-build/relative-pointer-unstable-v1-client-protocol.h:
67- mkdir -p build
68- wayland-scanner client-header ${PROTOS}/unstable/relative-pointer/relative-pointer-unstable-v1.xml $@
69-build/relative-pointer-unstable-v1-protocol.c:
70- mkdir -p build
71- wayland-scanner private-code ${PROTOS}/unstable/relative-pointer/relative-pointer-unstable-v1.xml $@
72-build/relative-pointer-unstable-v1-protocol.o: build/relative-pointer-unstable-v1-protocol.c build/relative-pointer-unstable-v1-client-protocol.h
73- mkdir -p build
74- ${CC} ${WL_CFLAGS} ${CPPFLAGS} -c build/relative-pointer-unstable-v1-protocol.c -o $@
75-
76-clean:
77- rm -rf build ${LIB_NAME} config.mk compile_flags.txt
78-
79-compile_flags:
80- rm -f compile_flags.txt
81- for f in ${CFLAGS} ${CPPFLAGS}; do echo $$f >> compile_flags.txt; done
82-
83-.PHONY: all clean compile_flags
84-
+14,
-11
1@@ -1,23 +1,26 @@
2 
3-is a small, cross-platform, software windowing library **now in ANSI C**
4+is a small, cross-platform, software windowing library written in ANSI C
5
6 ### Building
7-Unix:
8 ```sh
9-./configure [x11|wayland|mac]
10-make # That's it!
11-```
12-
13-Windows:
14-```
15-.\build.bat [msvc|gcc|clang]
16+meson setup build
17+ninja -C build
18 ```
19+Now you should have a libmaus_<platform>.a library file. Link that agains any
20+project that uses libmaus.
21 > If anyone is on Windows, please try to compile past the ANSI conversion.
22 > I pretty much converted it without checking so there may still be C99
23 > artefacts left behind.
24
25-After building, you have a library which you link _your_ sources with. It is
26-located in `build/`.
27+If you do not have access to meson, here is an example on manually building
28+the X11 backend:
29+```
30+# You don't need to also compile source/maus_font.c
31+cc -c source/maus.c source/maus_font.c source/maus_x11.c source/utils.c \
32+ -Iinclude -DBACKEND_X11 -lX11 -lXext -lXi
33+
34+ar rcs libmaus.a maus.o maus_font.o maus_x11.o utils.o
35+```
36
37 ### Usage
38 #### libmaus
+0,
-38
1@@ -1,38 +0,0 @@
2-@echo off
3-
4-if not exist build mkdir build
5-
6-set "COMPILER=%~1"
7-if "%COMPILER%"=="" set "COMPILER=gcc"
8-
9-if /I "%COMPILER%"=="msvc" goto msvc
10-if /I "%COMPILER%"=="gcc" goto gcc
11-if /I "%COMPILER%"=="clang" goto clang
12-
13-echo Usage: build.bat [msvc^|gcc^|clang]
14-exit /b 1
15-
16-:: MSVC
17-:msvc
18-cl /diagnostics:color /nologo /W3 /O2 /Iinclude /DBACKEND_WIN /c ^
19- source/maus.c source/maus_windows.c source/maus_font.c source/utils.c
20-lib /nologo /OUT:build\libmaus_windows.lib *.obj
21-move /Y *.obj build\
22-goto :eof
23-
24-:: GCC
25-:gcc
26-cc -ansi -pedantic-errors -Wall -Wextra -O2 -Iinclude -DBACKEND_WIN -c ^
27- source/maus.c source/maus_windows.c source/maus_font.c source/utils.c
28-move *.o build\
29-ar rcs build\libmaus_windows.a build\maus.o build\maus_windows.o build\maus_font.o build\utils.o
30-goto :eof
31-
32-:: GCC
33-:clang
34-clang -ansi -pedantic-errors -Wall -Wextra -O2 -Iinclude -DBACKEND_WIN -c ^
35- source/maus.c source/maus_windows.c source/maus_font.c source/utils.c
36-move *.o build\
37-ar rcs build\libmaus_windows.a build\maus.o build\maus_windows.o build\maus_font.o build\utils.o
38-goto :eof
39-
+0,
-50
1@@ -1,50 +0,0 @@
2-#!/bin/sh
3-
4-for arg do
5- case "$arg" in
6- --help)
7- echo "Usage: ./configure [x11|wayland|mac]"
8- exit 0
9- ;;
10- *)
11- if [ -n "$backend" ]; then
12- echo "Usage: ./configure [x11|wayland|mac]"
13- exit 1
14- fi
15- backend="$arg"
16- ;;
17- esac
18-done
19-
20-cat > config.mk << EOF
21-# Generated by configure script
22-BACKEND = $backend
23-EOF
24-
25-case "$backend" in
26- x11)
27- echo "CONF_CPPFLAGS = -DBACKEND_X11" >> config.mk
28- echo "CONF_LDFLAGS = -lX11 -lXext -lXi" >> config.mk
29- echo "CONF_SRC = source/maus_x11.c" >> config.mk
30- echo "CONF_OBJS = build/maus_x11.o" >> config.mk
31- echo "CONF_LIB_NAME = libmaus_x11.a" >> config.mk
32- ;;
33- wayland)
34- echo "CONF_CPPFLAGS = -DBACKEND_WAY $(pkg-config --cflags wayland-client wayland-cursor xkbcommon)" >> config.mk
35- echo "CONF_LDFLAGS = $(pkg-config --libs wayland-client wayland-cursor xkbcommon)" >> config.mk
36- echo "CONF_SRC = source/maus_wayland.c build/xdg-shell-protocol.c build/pointer-constraints-unstable-v1-protocol.c build/relative-pointer-unstable-v1-protocol.c" >> config.mk
37- echo "CONF_OBJS = build/maus_wayland.o build/xdg-shell-protocol.o build/pointer-constraints-unstable-v1-protocol.o build/relative-pointer-unstable-v1-protocol.o" >> config.mk
38- echo "CONF_LIB_NAME = libmaus_wayland.a" >> config.mk
39- echo "PROTOS = $(pkg-config --variable=pkgdatadir wayland-protocols)" >> config.mk
40- ;;
41- mac)
42- # TODO
43- ;;
44- *)
45- echo "Unsupported backend '$backend'"
46- rm -f config.mk
47- exit 1
48- ;;
49-esac
50-echo "Configuration done"
51-