-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
executable file
·66 lines (53 loc) · 1.25 KB
/
makefile
File metadata and controls
executable file
·66 lines (53 loc) · 1.25 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
.SUFFIXES: .c .o
SPX_SRC_PATH = ./
SPX_HEADER_PATH = ./
YDB_COMMON_HEADER_PATH = ./
TARGET = mempool
TARGET_PATH = /usr/local/bin
HEADER_TARGET_PATH = /usr/local/include/
CC = gcc
CFLAG = -pipe -o0 -W -Wall -Werror -g \
-Wpointer-arith -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wunused-value
INC_PATH = -I/usr/local/include
LIB_PATH =
DEFS :=
SYS := $(strip $(shell uname -s | tr '[:upper:]' '[:lower:]'))
ifeq ($(SYS), linux)
DEFS += -DSpxLinux
else
ifeq ($(SYS),unix)
DEFS += -DSpxUnix
else
ifeq ($(SYS),darwin)
DEFS += -DSpxMac
endif
endif
endif
BITS := $(findstring 64,$(shell uname -m ))
ifeq (64, $(BITS))
DEFS += -DSpx64
else
ifeq (32, $(BITS))
DEFS += -DSpx32
else
DEFS += -DSpx32
endif
endif
SRC_FILE = $(wildcard *.c)
HEADER_FILE = $(wildcard *.h)
SHARED_OBJS = $(patsubst %.c,%.o,$(SRC_FILE) )
all:$(TARGET)
%.o: %.c
$(CC) $(CFLAG) -c $< -o $@ $(LIB_PATH) $(INC_PATH) $(DEFS)
$(TARGET) : $(SHARED_OBJS)
$(CC) $(CFLAG) $(SHARED_OBJS) $(LIB_PATH) $(INC_PATH) -o $(TARGET) $(DEFS)
install:
cp -f $(TARGET) $(TARGET_PATH)
cp -f $(HEADER_FILE) $(HEADER_TARGET_PATH)
clean:
rm -f $(SHARED_OBJS) $(TARGET)
uninstall:
cd $(TARGET_PATH)
rm -f $(TARGET)
cd $(HEADER_TARGET_PATH)
rm -f $(HEADER_FILE)