-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakedefs
executable file
·55 lines (44 loc) · 1.11 KB
/
Makedefs
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
ifneq ($(OS),Windows_NT)
prefix = $(DESTDIR)/usr
exec_prefix = $(prefix)
libdir = $(exec_prefix)/lib
endif
ifneq ($(DEBUG),1)
CFLAGS += -Wall -Wextra -Werror -O3
CXXFLAGS += -Wall -Wextra -Werror -O3
else
ifneq ($(OS),Windows_NT)
CFLAGS += -Wall -Wextra -Werror -O0 -g -fsanitize=address -fno-omit-frame-pointer
CXXFLAGS += -Wall -Wextra -Werror -O0 -g -fsanitize=address -fno-omit-frame-pointer
else
CFLAGS += -Wall -Wextra -Werror -O0 -g -fno-omit-frame-pointer
CXXFLAGS += -Wall -Wextra -Werror -O0 -g -fno-omit-frame-pointer
endif
endif
NAME=$(shell basename "$(shell pwd)")
LIBNAME=lib$(NAME)
ifeq ($(OS),Windows_NT)
CPPFLAGS += -D__USE_MINGW_ANSI_STDIO=0
endif
CPPFLAGS += -DGLOG_NAME=$(NAME)
ifneq ($(OS),Windows_NT)
LIB=$(LIBNAME).so
else
LIB=$(LIBNAME).dll
endif
all: $(LIB)
$(LIB): $(OBJECTS)
$(CC) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) -shared $(OBJECTS) -o $@ $(LDFLAGS) $(LDLIBS)
clean:
$(RM) $(LIB) $(OBJECTS)
ifneq ($(OS),Windows_NT)
install: all
mkdir -p $(prefix)
mkdir -p $(libdir)
cp $(LIB) $(libdir)
uninstall:
-$(RM) $(libdir)/$(LIB)
-rmdir $(libdir)
-rmdir $(prefix)
really-clean: clean uninstall
endif