-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (56 loc) · 2.11 KB
/
Makefile
File metadata and controls
74 lines (56 loc) · 2.11 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
65
66
67
68
69
70
71
72
73
#-------------------------------------------------------------------------------------------------------
# #
# Makefile for socketcd source file #
# #
#-------------------------------------------------------------------------------------------------------
TARGET = socketcd
PROJECT = lib$(TARGET)
VERSION = 0.4
--PREFIX = ./install
CXX = g++
CXXFLAGS = -Werror -std=c++11
CXXFLAGS += -Wall
CXXFLAGS += -lpthread
CXXFLAGS += -I$(CURDIR)
#CXXFLAGS += -g
SUBDIRS = $(TARGET)/server $(TARGET)/client $(TARGET)/util
export CXX CXXFLAGS
#-------------------------------------------------------------------------------------------------------
# #
# Make rules #
# #
#-------------------------------------------------------------------------------------------------------
.PHONY: all clean install $(SUBDIRS) demo
all:$(SUBDIRS)
ar -rcs $(PROJECT).a $(shell find ./$(TARGET) -name "*.o")
$(CXX) -fPIC -shared $(CXXFLAGS) $(shell find ./$(TARGET) -name "*.cpp") -o $(PROJECT).so.$(VERSION)
ln -s $(PROJECT).so.$(VERSION) $(PROJECT).so
$(SUBDIRS):
$(MAKE) -C $@
demo:
$(MAKE) -C demo
install:
$(shell if [ ! -d $(--PREFIX) ]; then mkdir $(--PREFIX); fi;)
$(shell if [ ! -d $(--PREFIX)/include ]; then mkdir $(--PREFIX)/include; fi;)
$(shell if [ ! -d $(--PREFIX)/lib ]; then mkdir $(--PREFIX)/lib; fi;)
@cp $(TARGET) $(--PREFIX)/include -rf
@mv ./$(PROJECT).a ./$(PROJECT).so* $(--PREFIX)/lib
rm -rf `find ./$(--PREFIX)/include -name "*.o"`
rm -rf `find ./$(--PREFIX)/include -name "*.cpp"`
rm -rf `find ./$(--PREFIX)/include -name "Makefile"`
tags:
@rm -rf ./tags
ctags --exclude="docs" \
--exclude="*.o" \
--exclude="*.a" \
--exclude="*.so" \
--exclude="*.elf" \
--exclude="*.map" \
--exclude="*.lss" -R .
clean:
for dir in $(SUBDIRS); do \
$(MAKE) -C $$dir clean; \
done
@rm -rf $(shell find ./ -name "*.o")
@rm -rf $(PROJECT).so* $(PROJECT).a
@rm -rf ./install