blob: 01e23e2abbb309f8ebda100347434831123d61be (
plain) (
tree)
|
|
# 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
#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
OBJ =\
libsyscalls_get_datatype_description.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-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
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
|