-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.travis
More file actions
123 lines (104 loc) · 3.58 KB
/
Copy pathMakefile.travis
File metadata and controls
123 lines (104 loc) · 3.58 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
ifneq ($(VERBOSE),true)
QUIET:=@
VERBOSE=false
endif
ifndef CC
CC:=gcc
endif
ifndef CXX
CXX:=g++
endif
ifndef AR
AR:=ar
endif
ifndef CXXSTANDARD
CXXSTANDARD:=-std=c++14
endif
ifndef CSTANDARD
CSTANDARD:=-std=c11
endif
ifndef SOURCE_PATH
SOURCE_PATH=.
endif
ifndef BUILD_PATH
BUILD_PATH=$(SOURCE_PATH)/bin
endif
ifneq ($(shell getconf _XOPEN_VERSION 1>/dev/null 2>&1; echo $$?),0)
OUTPUTFILE:=posix_features.h
TESTLIST:=atexit memmove strerror strnlen atoll strtof strtold strtoll strtoul strtoull snprintf faccessat fexecve fchdir seteuid setegid sigqueue killpg
TESTFILE:="\#include <stdlib.h>\n\#include <string.h>\n\#include <stdio.h>\n\#include <unistd.h>\n\#include <signal.h>\nnamespace test { using ::$${funcname}; }\nint main(int, char*[]) { return 0; }"
TESTFILEPATH:=/tmp/test.cpp
$(shell rm -f $(OUTPUTFILE))
$(shell for funcname in $(TESTLIST); do echo $(TESTFILE) | sed -e "s/\\\\n/\\n/g" > $(TESTFILEPATH) && ${CXX} ${CXXSTANDARD} ${TESTFILEPATH} 1>/dev/null 2>&1 && echo "#HAVE_$${funcname}" | tr '[:lower:]' '[:upper:]' | sed -e "s/HAVE/define HAVE/" >> $(OUTPUTFILE) ; done)
endif
UNAME_FLAGS = -DUNAME_RELEASE="$(shell uname -r)" \
-DUNAME_VERSION="$(shell uname -v)" \
-DUNAME_MACHINE="$(shell uname -m)" \
-DUNAME_SYSNAME="$(shell uname -s)" \
$(shell uname -r | sed -e "s/^\([0-9]*\)\.*\([0-9]*\)\.*\([0-9]*\)\(.*\)$$/-DUNAME_KERNEL_MAJOR=\1 -DUNAME_KERNEL_MINOR=\2 -DUNAME_KERNEL_RELEASE=\3/")
INCLUDE_PATH = -I$(SOURCE_PATH)
STATICLIB = $(BUILD_PATH)/libput.a
INT_DEFINES = $(DEFINES) $(UNAME_FLAGS)
INT_CFLAGS = $(CFLAGS) $(INT_DEFINES) -pipe -g -Os -Wall -W -fPIC $(INCLUDE_PATH)
INT_CXXFLAGS = $(CXXFLAGS) $(INT_CFLAGS) -fno-exceptions -fno-rtti
INT_LDFLAGS = $(LDFLAGS) $(STATICLIB)
TARGET = all
SOURCES = application.cpp \
socket.cpp \
childprocess.cpp \
cxxutils/vfifo.cpp \
cxxutils/configmanip.cpp \
cxxutils/syslogstream.cpp \
cxxutils/translate.cpp \
cxxutils/stringtoken.cpp \
specialized/eventbackend.cpp \
specialized/mutex.cpp \
specialized/peercred.cpp \
specialized/procstat.cpp \
specialized/proclist.cpp \
specialized/fstable.cpp \
specialized/mount.cpp \
specialized/mountpoints.cpp \
specialized/module.cpp \
specialized/blockinfo.cpp \
specialized/blockdevices.cpp \
specialized/mountevent.cpp \
specialized/fileevent.cpp \
specialized/pollevent.cpp \
specialized/processevent.cpp \
specialized/timerevent.cpp \
# integration/sdl.cpp
UNITSOURCES = units/build_test.cpp \
units/proclist_test.cpp \
units/procstat_test.cpp \
units/blockinfo_test.cpp \
units/blockdevices_test.cpp \
#
OBJS := $(SOURCES:.s=.o)
OBJS := $(OBJS:.c=.o)
OBJS := $(OBJS:.cpp=.o)
OBJS := $(foreach f,$(OBJS),$(BUILD_PATH)/$(f))
SOURCES := $(foreach f,$(SOURCES),$(SOURCE_PATH)/$(f))
UNITS := $(foreach f,$(UNITSOURCES:.cpp=),$(BUILD_PATH)/$(f))
$(BUILD_PATH)/%.o: $(SOURCE_PATH)/%.cpp OUTPUT_DIR
@echo [Compiling]: $<
$(QUIET) $(CXX) -c -o $@ $< $(CXXSTANDARD) $(INT_CXXFLAGS)
$(BUILD_PATH)/%.o: $(SOURCE_PATH)/%.c OUTPUT_DIR
@echo [Compiling]: $<
$(QUIET) $(CC) -c -o $@ $< $(CSTANDARD) $(INT_CFLAGS)
$(BUILD_PATH)/%: $(STATICLIB) $(BUILD_PATH)/%.o
@echo [ Linking ]: $@
$(QUIET) $(CXX) -o $@ $@.o $(INT_LDFLAGS)
$(TARGET): $(STATICLIB) $(UNITS)
@echo [Completed]: $@
$(STATICLIB): $(OBJS)
@echo [Creating Library]: $@
$(QUIET) $(AR) rcs $@ $(OBJS)
OUTPUT_DIR:
$(QUIET) mkdir -p $(BUILD_PATH)/units
$(QUIET) mkdir -p $(BUILD_PATH)/cxxutils
$(QUIET) mkdir -p $(BUILD_PATH)/integration
$(QUIET) mkdir -p $(BUILD_PATH)/specialized
clean:
$(QUIET) rm -f $(TARGET)
$(QUIET) rm -rf $(BUILD_PATH)