summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Burakov <mburakov@mailbox.org>2021-02-27 19:09:27 +0100
committerMikhail Burakov <mburakov@mailbox.org>2021-02-27 19:09:27 +0100
commit6c307b32891f6645c99e864093789995126c32ae (patch)
tree0da8a1e6542e242442cb7218da4446984d3b6246
parent718beaa75be1c7ea84b298abd84eef4dd277f897 (diff)
Rework makefile for better buildingHEADmaster
-rw-r--r--makefile62
1 files changed, 45 insertions, 17 deletions
diff --git a/makefile b/makefile
index 56decbf..5c257db 100644
--- a/makefile
+++ b/makefile
@@ -1,26 +1,39 @@
+CFLAGS?=\
+ -Wall \
+ -Wextra \
+ -fvisibility=hidden \
+ -flto \
+ -Os
+
+LDFLAGS?=\
+ -flto \
+ -Os \
+ -s \
+ -lwayland-client \
+ -lrt
+
+protocols:=\
+ /usr/share/wayland-protocols
+
+wl_headers:=\
+ xdg-shell.h
+
+targets:=pui sample.pui
+
lib_objects:=\
font.o \
font_cp00.o \
font_cp04.o \
pui.o
+
bin_objects:=\
main.o \
- xdg-shell.o
-protocols:=/usr/share/wayland-protocols
-wl_headers:=xdg-shell.h
+ xdg-shell.o \
+ libpui.a
-CFLAGS?=-O3 -Wall -Wextra -Werror -pedantic -fvisibility=hidden
-LDFLAGS?=-O3 -s -lwayland-client -lrt
-
-all: libpui.a pui convert sample.pui
-
-sample.pui: convert sample.bmp sample.ini
- ./$^ > $@
-
-convert: convert.c
- $(CC) $(CFLAGS) -s $< -o $@
+all: $(targets)
-pui: $(bin_objects) libpui.a
+pui: $(bin_objects)
$(CC) $(LDFLAGS) $^ -o $@
libpui.a: $(lib_objects)
@@ -29,13 +42,28 @@ libpui.a: $(lib_objects)
%.o: %.c *.h $(wl_headers)
$(CC) $(CFLAGS) -c $< -o $@
+%.h: $(protocols)/*/*/%.xml
+ wayland-scanner client-header $< $@
+
%.c: $(protocols)/*/*/%.xml
wayland-scanner private-code $< $@
-%.h: $(protocols)/*/*/%.xml
- wayland-scanner client-header $< $@
+sample.pui: convert sample.bmp sample.ini
+ ./$^ > $@
+
+convert: convert.c
+ $(CC) $(CFLAGS) -s $< -o $@
clean:
- rm pui libpui.a $(bin_objects) $(lib_objects) $(wl_headers) convert sample.pui
+ -rm \
+ $(bin_objects) \
+ $(lib_objects) \
+ $(targets) \
+ $(wl_headers) \
+ convert \
+ libpui.a \
+ sample.pui
+
+.PHONY: all clean
.PRECIOUS: $(wl_headers)