-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (39 loc) · 1.15 KB
/
Makefile
File metadata and controls
49 lines (39 loc) · 1.15 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
include config.mk
OBJDIR = obj
LIB = lib$(LIBNAME).a
MAIN_SRCS = $(wildcard $(IMGUIDIR)/*.cpp)
MAIN_HDRS = $(wildcard $(IMGUIDIR)/*.h)
BACKEND_SRCS = $(BACKENDS:%=$(IMGUIDIR)/backends/imgui_impl_%.cpp)
BACKEND_HDRS = $(BACKENDS:%=$(IMGUIDIR)/backends/imgui_impl_%.h)
SRCS = $(MAIN_SRCS) $(BACKEND_SRCS)
HDRS = $(MAIN_HDRS) $(BACKEND_HDRS)
OBJS = $(SRCS:$(IMGUIDIR)/%.cpp=$(OBJDIR)/%.o)
DEPS = $(OBJS:.o=.d)
# build static library
all: $(LIB)
$(LIB): $(OBJS)
$(AR) rcs $@ $(OBJS)
$(OBJDIR)/%.o: $(IMGUIDIR)/%.cpp
@mkdir -p $(@D)
$(CXX) -I$(IMGUIDIR) $(CXXFLAGS) $(EXTRA_CFLAGS) -MD -MP -c $< -o $@
# install
install: $(LIB) $(HDRS) $(PCFILE)
install -d $(LIBDIR)
install -m 644 $(LIB) $(LIBDIR)
install -d $(INCDIR)
install -m 644 $(HDRS) $(INCDIR)
install -d $(PKGCONFIGDIR)
install -m 644 $(PCFILE) $(PKGCONFIGDIR)
uninstall:
rm -f $(LIBDIR)/$(LIB)
rm -f $(addprefix $(INCDIR)/,$(notdir $(HDRS)))
rm -f $(PKGCONFIGDIR)/$(PCFILE)
-rmdir $(LIBDIR) 2>/dev/null || true
-rmdir $(INCDIR) 2>/dev/null || true
-rmdir $(PKGCONFIGDIR) 2>/dev/null || true
#clean
clean:
rm -rf $(OBJDIR) $(LIB)
-include $(DEPS)
.PHONY: all clean install uninstall
.SUFFIXES: