-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile.common
More file actions
73 lines (60 loc) · 1.78 KB
/
Makefile.common
File metadata and controls
73 lines (60 loc) · 1.78 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Makefile
#
# Copyright (C) 2024 Michel Pollet <buserror@gmail.com>
#
# SPDX-License-Identifier: MIT
LIBMUI ?= ../
# for bsd_queue.h and incbin.h
#MII ?= $(LIBMUI)..
#CPPFLAGS += -I$(MII)/libmish/src -I$(MII)/contrib
CPPFLAGS += -I$(LIBMUI)contrib
BUILD_DIR ?= $(LIBMUI)
O := $(BUILD_DIR)build-$(shell $(CC) -dumpmachine)
BIN := $(O)/bin
OBJ := $(O)/obj/libmui
LIB := $(O)/lib
CPPFLAGS += -I$(LIBMUI)src
CPPFLAGS += -I$(LIBMUI)mui_shell
CPPFLAGS += ${shell pkg-config --cflags pixman-1}
LDLIBS += ${shell pkg-config --libs pixman-1}
MUI_VERSION := ${shell \
echo $$(git describe --tags --abbrev=0 2>/dev/null || \
echo "(dev)") \
$$(git log -1 --date=short --pretty="%h %cd")}
CPPFLAGS += -DMUI_VERSION="\"$(MUI_VERSION)\""
OPTIMIZE ?= -O0 -g
CFLAGS += --std=gnu99 -Wall -Wextra
CFLAGS += $(OPTIMIZE)
CFLAGS += -Wno-unused-parameter -Wno-unused-function
# PIC is necessary for the shared library/plugin to work
CFLAGS += -fPIC
#CFLAGS += -fsanitize=address
#LDFLAGS += -fsanitize=address
#LDLIBS +=
ifeq ($(V),1)
Q :=
else
Q := @
endif
# use a .temp file, otherwise the mui_shell tries to reload before the file
# is fully written, and it fails.
# the ${filter} are there to make the sure object files are linked before the .a
$(LIB)/%.so : $(OBJ)/%.o $(LIB)/libmui.a | $(O)
ifeq ($(V),)
@echo " LDSO $@"
endif
$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -shared -fPIC -o $@.temp \
${filter %.o, $^} ${filter %.a, $^} $(LDLIBS) && \
mv $@.temp $@
$(OBJ)/%.o : %.c | $(OBJ)
ifeq ($(V),)
@echo " CC" ${filter -O%, $(CPPFLAGS) $(CFLAGS)} "$<"
endif
$(Q)$(CC) -MMD $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
$(BIN)/% : | $(BIN)
ifeq ($(V),)
@echo " LD $@"
endif
$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(O) $(OBJ) $(BIN) $(LIB):
@mkdir -p $@