-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrules.mk
51 lines (41 loc) · 1.04 KB
/
rules.mk
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
CC = /usr/bin/gcc
WARNINGS = \
-Wall -Wextra \
-Wmissing-declarations \
-Wno-unused-parameter #-Wno-unused-function
DEBUGGING = -ggdb
ifndef DEBUG
OPTIMIZATIONS = -O2 -DNDEBUG
endif
DEFINES += \
LOG_WITH_POSITION \
#
LIBS += \
libz \
librt \
INCLUDE += .
CFLAGS = -std=gnu99 -Werror $(WARNINGS) $(OPTIMIZATIONS) $(DEBUGGING)\
$(patsubst %, -D%, $(DEFINES)) -pthread $(patsubst %, -I%, $(INCLUDE))\
$(shell mysql_config --include)
LDFLAGS = -pthread $(patsubst lib%, -l%, $(LIBS)) $(patsubst %, -L%, $(LINK)) \
$(shell mysql_config --libs)
#TOOLCHAIN_BUILD = 1
ifeq ($(TOOLCHAIN_BUILD), 1)
KROBIX = /opt/krobix/tools
PATH = $(KROBIX)/bin
LDFLAGS += -Wl,--dynamic-linker,/lib/ld-linux-x86-64.so.2
LINK += $(KROBIX)/lib/mysql
else
LINK += /usr/lib64/mysql
endif
.PHONEY: etags all_clean
all_clean: clean
$(RM) .*.mk TAGS core.* vgcore.*
.%.mk: %.c
$(CC) -o $@ -M -MM -MG $(CFLAGS) $<
$(CC) -M -MG -MM -MT $@ $(CFLAGS) $< >> $@
etags:
/usr/bin/ctags -e *.c *.h
ifneq ($(MAKECMDGOALS),clean)
include $(patsubst %.o, .%.mk, $(OFILES))
endif