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