forked from xemul/libct
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
172 lines (134 loc) · 3.01 KB
/
Makefile
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
include Makefile.config
MAKEFLAGS := -r -R --no-print-directory
ifeq ($(strip $(V)),)
E = @echo
Q = @
else
E = @\#
Q =
endif
FIND := find
CSCOPE := cscope
TAGS := ctags
RM := rm -f
CP := cp
LD := ld
CC := gcc
CD := cd
ECHO := echo
NM := nm
AWK := awk
SH := bash
MAKE := make
OBJCOPY := objcopy
MKDIR := mkdir
LN := ln
ESED := esed
SED := sed
CAT := cat
#
# Fetch ARCH from the uname if not yet set
#
ARCH ?= $(shell uname -m | sed \
-e s/i.86/i386/ \
-e s/sun4u/sparc64/ \
-e s/arm.*/arm/ \
-e s/sa110/arm/ \
-e s/s390x/s390/ \
-e s/parisc64/parisc/ \
-e s/ppc.*/powerpc/ \
-e s/mips.*/mips/ \
-e s/sh[234].*/sh/)
ifeq ($(ARCH),x86_64)
ARCH := x86
DEFINES := -DCONFIG_X86_64 -DARCH="\"$(ARCH)\""
LDARCH := i386:x86-64
endif
ifneq ($(ARCH),x86)
$(error "The architecture $(ARCH) isn't supported"))
endif
ifneq ("$(wildcard /proc/vz)","")
VZ := 1
endif
cflags-y += -iquote src/include
cflags-y += -iquote src/include/vz
cflags-y += -iquote src/lsm
cflags-y += -iquote src
cflags-y += -fno-strict-aliasing
cflags-y += -I/usr/include
export cflags-y
VERSION_MAJOR := 0
VERSION_MINOR := 1
VERSION_SUBLEVEL := 0
VERSION_EXTRA :=
VERSION_NAME :=
export VERSION_MAJOR VERSION_MINOR VERSION_SUBLEVEL VERSION_EXTRA VERSION_NAME
include scripts/Makefile.version
include scripts/Makefile.config
LIBS := -lrt
DEFINES += -D_FILE_OFFSET_BITS=64
DEFINES += -D_GNU_SOURCE
WARNINGS := -Wall -Wno-unused-result
ifneq ($(WERROR),0)
WARNINGS += -Werror
endif
ifeq ($(DEBUG),1)
DEFINES += -DCR_DEBUG
CFLAGS += -O0 -ggdb3
else
CFLAGS += -O2
endif
ifdef CONFIG_APPARMOR
DEFINES += -DHAVE_APPARMOR
endif
ifdef CONFIG_SELINUX
DEFINES += -DHAVE_SELINUX
endif
CFLAGS += $(WARNINGS) $(DEFINES)
export E Q CC ECHO MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS
export SH RM OBJCOPY LDARCH LD CP MKDIR CD LN
export ESED SED CAT
include scripts/Makefile.rules
build := -r -R --no-print-directory -f scripts/Makefile.build makefile=Makefile obj
run := -r -R --no-print-directory
LIBCT := libct
.PHONY: all clean tags docs
cflags-y += -I.shipped/libnl/include/
cflags-y += -iquote src/include
cflags-y += -iquote src/arch/$(ARCH)/include
export cflags-y
#
# First order targets, usually pregenerated
EARLY-GEN := $(VERSION_HEADER) config
#
# Library itself
src/%: $(EARLY-GEN)
$(Q) $(MAKE) $(build)=src $@
src: $(EARLY-GEN)
$(Q) $(MAKE) $(build)=src all
.PHONY: src
$(LIBCT).a: src/$(LIBCT).a
$(E) " LN " $@
$(Q) $(LN) -sf $^ $@
$(LIBCT).so: src/$(LIBCT).so
$(E) " LN " $@
$(Q) $(LN) -sf $^ $@
src/$(LIBCT).so: src/$(LIBCT).a
all: $(LIBCT).so $(LIBCT).a
@true
docs:
$(Q) $(MAKE) -s -C Documentation all
docs-pdf:
$(Q) $(MAKE) -s -C Documentation all-pdfs
tags:
$(E) " GEN " $@
$(Q) $(RM) tags
$(Q) $(FIND) -L . -name '*.[hcS]' ! -path './.*' -print | xargs ctags -a
clean:
$(Q) $(MAKE) $(build)=src clean
$(Q) $(MAKE) -C test clean
$(Q) $(MAKE) -s -C Documentation clean
$(Q) $(RM) $(LIBCT)
$(Q) $(RM) $(CONFIG)
$(Q) $(RM) $(VERSION_HEADER)
.DEFAULT_GOAL := all