# 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 =\ ALPHA_LE\ ALPHA_BE\ AMD64\ AMD64_X32\ IA64_LE\ IA64_BE\ IA64_P32_LE\ IA64_P32_BE\ M68K\ MICROBLAZE_32_LE\ MICROBLAZE_32_BE\ MICROBLAZE_64_LE\ MICROBLAZE_64_BE\ MIPS_O32_LE\ MIPS_O32_BE\ MIPS_N32_LE\ MIPS_N32_BE\ MIPS_N64_LE\ MIPS_N64_BE\ PARISC_32\ PARISC_64\ POWERPC_32_LE\ POWERPC_32_BE\ POWERPC_64_LE\ POWERPC_64_BE\ POWERPC_NOSPU_LE\ POWERPC_NOSPU_BE\ POWERPC_SPU_LE\ POWERPC_SPU_BE\ S390_32\ S390_64\ SH_LE\ SH_BE\ SPARC_32\ SPARC_64_LE\ SPARC_64_BE\ I386\ XTENSA_LE\ XTENSA_BE # Excluded because of incomplete support (see LIST_ARCH_SPECS in common.h): # ARM_OABI_LE ARM_OABI_BE ARM_EABI_LE ARM_EABI_BE 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_struct_description.o\ libsyscalls_get_syscall.o\ libsyscalls_get_syscall_display_info.o\ libsyscalls_get_syscall_errors.o\ libsyscalls_get_syscall_range.o\ libsyscalls_find_named_number.o\ libsyscalls_make_signed_integer.o\ libsyscalls_parse_signed_integer.o\ libsyscalls_perror.o\ libsyscalls_section_value.o\ libsyscalls_strerror.o\ libsyscalls_syscalls_tables_.o\ libsyscalls_to_tracee_endian.o\ libsyscalls_to_tracer_endian.o\ libsyscalls_unsection_value.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/make-signed.tu\ testutil/parse-signed.tu\ testutil/perror-all.tu\ testutil/perror-bad.tu\ testutil/section-value.tu\ testutil/strerror-all.tu\ testutil/strerror-bad.tu\ testutil/test-search.tu\ testutil/to-tracee-endian.tu\ testutil/to-tracer-endian.tu\ testutil/unsection-value.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 '^t=:' < ./test >/dev/null; then \ printf '\033[1;33m%s\033[m\n' 'Warning! tests have been disabled' >&2; \ fi @if grep '^alias p=' < ./test >/dev/null; then \ printf '\033[1;33m%s\033[m\n' 'Warning! tests are running synchronously' >&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 .*.tmp.c -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