xref: /freebsd/lib/libsysdecode/Makefile (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
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_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
129tables.h: mktables
130	sh ${.CURDIR}/mktables ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} ${.TARGET}
131tables_linux.h: mklinuxtables
132	sh ${.CURDIR}/mklinuxtables ${SRCTOP}/sys ${.TARGET}
133
134# mkioctls runs find(1) for headers so needs to rebuild every time.  This used
135# to be a hack only done in buildworld.
136.if !defined(_SKIP_BUILD)
137ioctl.c.tmp: .PHONY
138.endif
139ioctl.c.tmp: mkioctls .META
140	env CPP="${CPP}" MK_PF="${MK_PF}" \
141	    /bin/sh ${.CURDIR}/mkioctls ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} > ${.TARGET}
142
143ioctl.c: ioctl.c.tmp
144	if [ ! -e ${.TARGET} ] || ! cmp -s ${.TARGET} ${.TARGET}.tmp; then \
145		mv -f ${.TARGET}.tmp ${.TARGET}; \
146	fi
147
148beforedepend: ioctl.c tables.h tables_linux.h
149
150HAS_TESTS=
151SUBDIR.${MK_TESTS}+= tests
152
153.include <bsd.lib.mk>
154