xref: /freebsd/lib/libsysdecode/Makefile (revision 397e83df75e0fcd0d3fcb95ae4d794cb7600fc89)
1
2.include <src.opts.mk>
3
4LIB=	sysdecode
5
6SRCS=	errno.c flags.c ioctl.c signal.c syscallnames.c utrace.c support.c
7.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
8	${MACHINE_CPUARCH} == "i386"
9SRCS+= linux.c
10.endif
11INCS=	sysdecode.h
12
13CFLAGS+= -I${.OBJDIR}
14CFLAGS+= -I${SRCTOP}/sys
15CFLAGS+= -I${SRCTOP}/libexec/rtld-elf
16
17MAN=	sysdecode.3 \
18	sysdecode_abi_to_freebsd_errno.3 \
19	sysdecode_cap_rights.3 \
20	sysdecode_cmsg_type.3 \
21	sysdecode_enum.3 \
22	sysdecode_fcntl_arg.3 \
23	sysdecode_kevent.3 \
24	sysdecode_ioctlname.3 \
25	sysdecode_mask.3 \
26	sysdecode_quotactl_cmd.3 \
27	sysdecode_sctp_sinfo_flags.3 \
28	sysdecode_sigcode.3 \
29	sysdecode_sockopt_name.3 \
30	sysdecode_socket_protocol.3 \
31	sysdecode_syscallnames.3 \
32	sysdecode_utrace.3
33MLINKS= sysdecode_abi_to_freebsd_errno.3 sysdecode_freebsd_to_abi_errno.3
34MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \
35	sysdecode_enum.3 sysdecode_atfd.3 \
36	sysdecode_enum.3 sysdecode_extattrnamespace.3 \
37	sysdecode_enum.3 sysdecode_fadvice.3 \
38	sysdecode_enum.3 sysdecode_fcntl_cmd.3 \
39	sysdecode_enum.3 sysdecode_getfsstat_mode.3 \
40	sysdecode_enum.3 sysdecode_getrusage_who.3 \
41	sysdecode_enum.3 sysdecode_idtype.3 \
42	sysdecode_enum.3 sysdecode_ipproto.3 \
43	sysdecode_enum.3 sysdecode_kldsym_cmd.3 \
44	sysdecode_enum.3 sysdecode_kldunload_flags.3 \
45	sysdecode_enum.3 sysdecode_lio_listio_mode.3 \
46	sysdecode_enum.3 sysdecode_madvice.3 \
47	sysdecode_enum.3 sysdecode_minherit_flags.3 \
48	sysdecode_enum.3 sysdecode_msgctl_cmd.3 \
49	sysdecode_enum.3 sysdecode_nfssvc_flags.3 \
50	sysdecode_enum.3 sysdecode_pathconf_name.3 \
51	sysdecode_enum.3 sysdecode_prio_which.3 \
52	sysdecode_enum.3 sysdecode_procctl_cmd.3 \
53	sysdecode_enum.3 sysdecode_ptrace_request.3 \
54	sysdecode_enum.3 sysdecode_rlimit.3 \
55	sysdecode_enum.3 sysdecode_rtprio_function.3 \
56	sysdecode_enum.3 sysdecode_scheduler_policy.3 \
57	sysdecode_enum.3 sysdecode_sctp_pr_policy.3 \
58	sysdecode_enum.3 sysdecode_semctl_cmd.3 \
59	sysdecode_enum.3 sysdecode_shmctl_cmd.3 \
60	sysdecode_enum.3 sysdecode_shutdown_how.3 \
61	sysdecode_enum.3 sysdecode_sigbus_code.3 \
62	sysdecode_enum.3 sysdecode_sigchld_code.3 \
63	sysdecode_enum.3 sysdecode_sigfpe_code.3 \
64	sysdecode_enum.3 sysdecode_sigill_code.3 \
65	sysdecode_enum.3 sysdecode_signal.3 \
66	sysdecode_enum.3 sysdecode_sigprocmask_how.3 \
67	sysdecode_enum.3 sysdecode_sigsegv_code.3 \
68	sysdecode_enum.3 sysdecode_sigtrap_code.3 \
69	sysdecode_enum.3 sysdecode_sockaddr_family.3 \
70	sysdecode_enum.3 sysdecode_socketdomain.3 \
71	sysdecode_enum.3 sysdecode_sockettype.3 \
72	sysdecode_enum.3 sysdecode_sockopt_level.3 \
73	sysdecode_enum.3 sysdecode_sysarch_number.3 \
74	sysdecode_enum.3 sysdecode_umtx_op.3 \
75	sysdecode_enum.3 sysdecode_vmresult.3 \
76	sysdecode_enum.3 sysdecode_whence.3
77MLINKS+=sysdecode_fcntl_arg.3 sysdecode_fcntl_arg_p.3
78MLINKS+=sysdecode_kevent.3 sysdecode_kevent_fflags.3 \
79	sysdecode_kevent.3 sysdecode_kevent_filter.3 \
80	sysdecode_kevent.3 sysdecode_kevent_flags.3
81MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \
82	sysdecode_mask.3 sysdecode_atflags.3 \
83	sysdecode_mask.3 sysdecode_capfcntlrights.3 \
84	sysdecode_mask.3 sysdecode_fcntl_fileflags.3 \
85	sysdecode_mask.3 sysdecode_fileflags.3 \
86	sysdecode_mask.3 sysdecode_filemode.3 \
87	sysdecode_mask.3 sysdecode_flock_operation.3 \
88	sysdecode_mask.3 sysdecode_mlockall_flags.3 \
89	sysdecode_mask.3 sysdecode_mmap_flags.3 \
90	sysdecode_mask.3 sysdecode_mmap_prot.3 \
91	sysdecode_mask.3 sysdecode_mount_flags.3 \
92	sysdecode_mask.3 sysdecode_msg_flags.3 \
93	sysdecode_mask.3 sysdecode_msync_flags.3 \
94	sysdecode_mask.3 sysdecode_open_flags.3 \
95	sysdecode_mask.3 sysdecode_pipe2_flags.3 \
96	sysdecode_mask.3 sysdecode_pollfd_events.3 \
97	sysdecode_mask.3 sysdecode_reboot_howto.3 \
98	sysdecode_mask.3 sysdecode_rfork_flags.3 \
99	sysdecode_mask.3 sysdecode_semget_flags.3 \
100	sysdecode_mask.3 sysdecode_sendfile_flags.3 \
101	sysdecode_mask.3 sysdecode_shmat_flags.3 \
102	sysdecode_mask.3 sysdecode_sctp_nxt_flags.3 \
103	sysdecode_mask.3 sysdecode_sctp_rcv_flags.3 \
104	sysdecode_mask.3 sysdecode_sctp_snd_flags.3 \
105	sysdecode_mask.3 sysdecode_socket_type.3 \
106	sysdecode_mask.3 sysdecode_thr_create_flags.3 \
107	sysdecode_mask.3 sysdecode_umtx_cvwait_flags.3 \
108	sysdecode_mask.3 sysdecode_umtx_rwlock_flags.3 \
109	sysdecode_mask.3 sysdecode_vmprot.3 \
110	sysdecode_mask.3 sysdecode_wait4_options.3 \
111	sysdecode_mask.3 sysdecode_wait6_options.3
112
113CLEANFILES= ioctl.c ioctl.c.tmp tables.h tables_linux.h
114
115# XXX: The flags should come from bsd.compat.mk / Makefile.libcompat
116.if ${COMPAT_LIBCOMPAT:U} == "32"
117CPP+=	-m32
118.endif
119
120.if ${MK_PF} != "no"
121CFLAGS+=-DPF
122.endif
123
124# Workaround duplicate declarations in <netinet/ip_compat.h>
125CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
126
127CFLAGS.gcc+=	${CFLAGS.gcc.${.IMPSRC}}
128
129DEPENDOBJS+=	tables.h tables_linux.h
130.if ${MK_DIRDEPS_BUILD} == "yes"
131MKTABLES_INCLUDEDIR= ${STAGE_INCLUDEDIR}
132.else
133MKTABLES_INCLUDEDIR= ${SYSROOT:U${DESTDIR}}${INCLUDEDIR}
134.endif
135tables.h: mktables
136	sh ${.CURDIR}/mktables ${MKTABLES_INCLUDEDIR} ${.TARGET}
137tables_linux.h: mklinuxtables
138	sh ${.CURDIR}/mklinuxtables ${SRCTOP}/sys ${.TARGET}
139
140# mkioctls runs find(1) for headers so needs to rebuild every time.  This used
141# to be a hack only done in buildworld.
142.if !defined(_SKIP_BUILD)
143ioctl.c.tmp: .PHONY
144.endif
145ioctl.c.tmp: mkioctls .META
146	env CPP="${CPP}" MK_PF="${MK_PF}" \
147	    /bin/sh ${.CURDIR}/mkioctls ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} > ${.TARGET}
148
149ioctl.c: ioctl.c.tmp
150	if [ ! -e ${.TARGET} ] || ! cmp -s ${.TARGET} ${.TARGET}.tmp; then \
151		mv -f ${.TARGET}.tmp ${.TARGET}; \
152	fi
153
154beforedepend: ioctl.c tables.h tables_linux.h
155
156HAS_TESTS=
157SUBDIR.${MK_TESTS}+= tests
158
159.include <bsd.lib.mk>
160