-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
118 lines (91 loc) · 3.18 KB
/
Makefile
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#**********************************
#
# @file Makefile
# @author Thomas Gijsbers (@RaichuBender)
# @brief Root folder Makefile
# @version 0.1
# @date 2021/09/24
#
# @copyright © Copyright 2021 — Thomas Gijsbers
# All rights reserved.
#
#**********************************
include common.mk
BINDIR := bin/
OBJDIR := obj/
EXE_BASE := main
EXE := $(BINDIR)$(EXE_BASE)$(EXE_SFX)
include objects.mk
ifeq ($(STATIC_LINK),TRUE)
OBJECTS += $(LANG_OBJECTS)
else
LIB := -Llib -llanguages
endif
OBJECTS += $(UI_OBJECTS) lib/symsym.o
OUT := $(BINDIR) $(OBJDIR)
PRECOMPILE := include/ui.h.gch include/sys/common.h.gch
default: dbg
d: $(OUT)
@$(MAKE) -C modules/languages
@$(MAKE) $(PRECOMPILE)
# @$(MAKE) lib/libsymsym.so
@$(MAKE) lib/symsym.o
@$(MAKE) $(EXE)
dbg:
# @$(MAKE) d -E'override PROFILE:=DEBUG' -E'override STATIC_LINK:=FALSE'
@$(MAKE) d -E'override PROFILE:=DBG_O2' -E'override STATIC_LINK:=FALSE'
.PHONY: all dbg pkg all-pkg clean clean-all clean-derived force-clean-all r rs pkg r-pkg rs-pkg deploy build install uninstall
include todo.mk
install:
-rm -r /usr/local/bin/decompiler /usr/lib/liblanguages.so /usr/local/lib/liblanguages.so /usr/local/share/decompiler ~/.local/share/applications/decompiler.desktop
cp bin/main /usr/local/bin/decompiler
cp lib/liblanguages.so /usr/local/lib
ln -s /usr/local/lib/liblanguages.so /usr/lib/liblanguages.so
mkdir -p /usr/local/share/decompiler
cp .pokeyellow.gbc /usr/local/share/decompiler
cp decompiler.desktop ~/.local/share/applications
uninstall:
-rm -r /usr/local/bin/decompiler /usr/lib/liblanguages.so /usr/local/lib/liblanguages.so /usr/local/share/decompiler ~/.local/share/applications/decompiler.desktop
$(EXE): LIB += $(shell pkg-config --libs gtk4) -rdynamic
$(EXE): $(OBJECTS)
$(CC) -o $@ $^ $(CFLAGS) $(INCLUDE) $(LIB)
-ln -s bin/main main
obj/%.o: src/%.c
$(CC) -o $@ -c $^ $(CFLAGS) $(INCLUDE) $(LIB)
include/ui.h.gch: include/ui.h
$(CC) $< $(CFLAGS) $(INCLUDE) $(shell pkg-config --cflags gtk4) -rdynamic
include/sys/common.h.gch: include/sys/common.h
$(CC) $< $(CFLAGS) $(INCLUDE)
obj/%.o: src/ui/%.c
$(CC) -o $@ -c $^ $(CFLAGS) $(INCLUDE) $(shell pkg-config --cflags gtk4) $(LIB) $(shell pkg-config --libs gtk4) -rdynamic
# lib/libsymsym.so: symsym.c
# $(CC) -o $@ -shared $^ $(CFLAGS) $(INCLUDE) $(LIB)
lib/symsym.o: symsym.c
$(CC) -o $@ -c $^ $(CFLAGS) $(INCLUDE) $(LIB)
$(OUT):
@-mkdir $@
PKG = build
$(PKG):
-mkdir $@
pkg: $(PKG)
mv $(EXE) $</$(EXE)
cp .pokeyellow.gbc $(PKG)/.pokeyellow.gbc # TODO placeholder
@$(MAKE) clean
force-clean-all:
@echo "\n\n"'⚠️ ⚠️ ⚠️ WARNING ⚠️ ⚠️ ⚠️'"\n"
@echo This will completely uninstall the program from this machine!
@echo Press ^C to abort now
@echo ... otherwise any other key to continue
@read dum
@$(MAKE) clean clean-all clean-derived uninstall
clean-after-install:
@$(MAKE) clean clean-all clean-derived
clean:
-rm -rvf $(OUT)
# @$(MAKE) -C modules/languages clean
@$(MAKE) -C modules/languages clean-all
clean-all:
-rm -rvf $(EXE_BASE)* $(OUT) $(PKG)
@$(MAKE) -C modules/languages clean-all
clean-derived:
-rm -vf $(PRECOMPILE) include/*.gch include/*.pch #lib/libsymsym.so lib/symsym.o