diff options
Diffstat (limited to '')
-rw-r--r-- | Makefile | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7b0ecb3 --- /dev/null +++ b/Makefile @@ -0,0 +1,149 @@ +.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 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 + + +.SUFFIXES: +.SUFFIXES: .lo .o .c + + +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 + +LOBJ = $(OBJ:.o=.lo) + + +$(OBJ): $(HDR) +$(LOBJ): $(HDR) + +.c.o: + $(CC) -c -o $@ $< $(CFLAGS) $(IMPORTANT_CFLAGS) $(CPPFLAGS) $(IMPORTANT_CPPFLAGS) + +.c.lo: + $(CC) -fPIC -c -o $@ $< $(CFLAGS) $(IMPORTANT_CFLAGS) $(CPPFLAGS) $(IMPORTANT_CPPFLAGS) + +libsyscalls.a: $(OBJ) + @rm -f -- $@ + $(AR) rc $@ $(OBJ) + $(AR) ts $@ > /dev/null + +libsyscalls.$(LIBEXT): $(LOBJ) + $(CC) $(LIBFLAGS) -o $@ $(LOBJ) $(LDFLAGS) + +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) + -rm -f -- libsyscalls/short-enums.h + +.PHONY: all download install uninstall clean semiclean |