blob: 6d520cac8b1821e59efe6284a1d82c3a3fd4b27c (
plain) (
blame)
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
# See LICENSE file for copyright and license details.
.POSIX:
# Choose either yes or no (determines whether system call,
# signal, and error tables, for the list operating systems,
# shall be compiled into the library)
LINUX_SUPPORT = $(DEFAULT_OS_SUPPORT_SELECTION)
# Choose operating system to compile the library for
OS = linux
# Linux: linux
# Mac OS: macos
# Windows: windows
CONFIGFILE = config.mk
include $(CONFIGFILE)
include mk/$(OS).mk
LIB_MAJOR = 1
LIB_MINOR = 0
LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
LIB_NAME = syscalls
all: libsyscalls.a libsyscalls.$(LIBEXT)
#extended for each support operating system to download the operating system's source code
download:
SUPPORTED_ARCHES =\
AMD64\
AMD64_X32\
M68K\
PARISC_32\
PARISC_64\
SPARC_32\
I386
# Excluded because of missing support in libsyscalls_get_datatype_description.c:
# ALPHA ARM_OABI ARM_EABI IA64 MICROBLAZE MIPS_O32 MIPS_N32 MIPS_N64 POWERPC_32
# POWERPC_64 POWERPC_NOSPU POWERPC_SPU S390_32 S390_64 SH SPARC_64 XTENSA
include $(CONFIGFILE)
# Reloading the user's config in case it limits supported architectures
#this not modify, this is a help variable to get the # symbol into sed scripts
h = '"$$(printf '\43\n')"'
#this not modify, this is a help variable to make [[:space:]] shorter
s = [[:space:]]
#extended for each support operating system with the operating system's name as appropriate for filenames
OPERATING_SYSTEMS =
#extended with supported architectures for each operating system
TEST_ENV =
#extended for each support operating system with the number of syscall parameters they use
NPARAMS =
#extended for each support operating system with the maximum used number of fields in its structs and unions
NFIELDS =
#extended for each support operating system
OBJ =\
libsyscalls_get_datatype_description.o\
libsyscalls_get_integer_alignment.o\
libsyscalls_get_signals.o\
libsyscalls_get_syscall.o\
libsyscalls_get_syscall_display_info.o\
libsyscalls_get_syscall_errors.o\
libsyscalls_get_syscall_range.o\
libsyscalls_perror.o\
libsyscalls_strerror.o\
libsyscalls_syscalls_tables_.o
#extended for each support operating system
HDR =\
libsyscalls.h\
common.h\
generated/arches.h\
generated/lowercase.h\
generated/oses.h\
generated/macros.h\
$(SUBHDR)
SUBHDR =\
libsyscalls/advanced.h\
libsyscalls/internal-begin.h\
libsyscalls/internal-end.h\
libsyscalls/short-enums.h
TESTUTILS =\
testutil/get-datatype-description.tu\
testutil/get-error.tu\
testutil/get-integer-alignment.tu\
testutil/get-section-fraction.tu\
testutil/get-signals.tu\
testutil/get-syscall-errors.tu\
testutil/get-syscall-range.tu\
testutil/is-section-half.tu\
testutil/is-section-quarter.tu\
testutil/is-datatype-struct.tu\
testutil/list-errors.tu\
testutil/perror-all.tu\
testutil/perror-bad.tu\
testutil/strerror-all.tu\
testutil/strerror-bad.tu
.SUFFIXES:
.SUFFIXES: .lo .o .c .tu
include linux/$(LINUX_SUPPORT).mk
include mk/generate.mk
include $(CONFIGFILE)
# Reloading the user's config as the makefiles for the OS
# may have made changes to what is supported
TEST_ENV += SUPPORTED_OSES="$(OPERATING_SYSTEMS)"
LOBJ = $(OBJ:.o=.lo)
$(OBJ): $(HDR)
$(LOBJ): $(HDR)
$(TESTUTILS): $(HDR) libsyscalls.a
.c.o:
$(CC) -c -o $@ $< $(CFLAGS) $(IMPORTANT_CFLAGS) $(CPPFLAGS) $(IMPORTANT_CPPFLAGS)
.c.lo:
$(CC) -fPIC -c -o $@ $< $(CFLAGS) $(IMPORTANT_CFLAGS) $(CPPFLAGS) $(IMPORTANT_CPPFLAGS)
.c.tu:
$(CC) -o $@ $< libsyscalls.a $(CFLAGS) $(CPPFLAGS)
libsyscalls.a: $(OBJ)
@rm -f -- $@
$(AR) rc $@ $(OBJ)
$(AR) ts $@ > /dev/null
libsyscalls.$(LIBEXT): $(LOBJ)
$(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS)
check: $(TESTUTILS)
env CPP="$(CPP)" $(TEST_ENV) ./test
@if grep '^alias t=:' < ./test >/dev/null; then \
printf '\033[1;33m%s\033[m\n' 'Warning! tests have been disabled' >&2; \
fi
install: libsyscalls.a libsyscalls.$(LIBEXT)
mkdir -p -- "$(DESTDIR)$(PREFIX)/lib"
mkdir -p -- "$(DESTDIR)$(PREFIX)/include/libsyscalls"
cp -- libsyscalls.a "$(DESTDIR)$(PREFIX)/lib/"
cp -- libsyscalls.$(LIBEXT) "$(DESTDIR)$(PREFIX)/lib/libsyscalls.$(LIBMINOREXT)"
$(FIX_INSTALL_NAME) "$(DESTDIR)$(PREFIX)/lib/libsyscalls.$(LIBMINOREXT)"
ln -sf -- libsyscalls.$(LIBMINOREXT) "$(DESTDIR)$(PREFIX)/lib/libsyscalls.$(LIBMAJOREXT)"
ln -sf -- libsyscalls.$(LIBMAJOREXT) "$(DESTDIR)$(PREFIX)/lib/libsyscalls.$(LIBEXT)"
cp -- libsyscalls.h "$(DESTDIR)$(PREFIX)/include/"
cp -- $(SUBHDR) "$(DESTDIR)$(PREFIX)/include/libsyscalls/"
uninstall:
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libsyscalls.a"
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libsyscalls.$(LIBMAJOREXT)"
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libsyscalls.$(LIBMINOREXT)"
-rm -f -- "$(DESTDIR)$(PREFIX)/lib/libsyscalls.$(LIBEXT)"
-rm -f -- "$(DESTDIR)$(PREFIX)/include/libsyscalls.h"
-cd -- "$(DESTDIR)$(PREFIX)/include/" && rm -f -- $(SUBHDR)
-rmdir -- "$(DESTDIR)$(PREFIX)/include/libsyscalls"
clean: buildclean
-rm -rf -- $(OPERATING_SYSTEMS:=-src/)
buildclean: semiclean
-rm -rf -- generated/ $(OPERATING_SYSTEMS:=-src/*/)
semiclean:
-rm -f -- *.o *.lo *.su *.gch *.gcov *.gcno *.gcda .*.tmp
-rm -f -- */*.o */*.lo */*.su */*.gch */*.gcov */*.gcno */*.gcda
-rm -f -- *.a *.so *.so.* *.dll *.dylib *.$(LIBEXT) */*.tu
-rm -f -- libsyscalls/short-enums.h
.PHONY: all download check install uninstall clean semiclean
|