xref: /freebsd/lib/libsysdecode/Makefile (revision d5b0e70f7e04d971691517ce1304d86a1e367e2e)
1# $FreeBSD$
2
3.include <src.opts.mk>
4
5LIB=	sysdecode
6
7SRCS=	errno.c flags.c ioctl.c signal.c syscallnames.c utrace.c support.c
8.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
9	${MACHINE_CPUARCH} == "i386"
10SRCS+= linux.c
11.endif
12INCS=	sysdecode.h
13
14CFLAGS+= -I${.OBJDIR}
15CFLAGS+= -I${SRCTOP}/sys
16CFLAGS+= -I${SRCTOP}/libexec/rtld-elf
17
18MAN=	sysdecode.3 \
19	sysdecode_abi_to_freebsd_errno.3 \
20	sysdecode_cap_rights.3 \
21	sysdecode_cmsg_type.3 \
22	sysdecode_enum.3 \
23	sysdecode_fcntl_arg.3 \
24	sysdecode_kevent.3 \
25	sysdecode_ioctlname.3 \
26	sysdecode_mask.3 \
27	sysdecode_quotactl_cmd.3 \
28	sysdecode_sctp_sinfo_flags.3 \
29	sysdecode_sigcode.3 \
30	sysdecode_sockopt_name.3 \
31	sysdecode_socket_protocol.3 \
32	sysdecode_syscallnames.3 \
33	sysdecode_utrace.3
34MLINKS= sysdecode_abi_to_freebsd_errno.3 sysdecode_freebsd_to_abi_errno.3
35MLINKS+=sysdecode_enum.3 sysdecode_acltype.3 \
36	sysdecode_enum.3 sysdecode_atfd.3 \
37	sysdecode_enum.3 sysdecode_extattrnamespace.3 \
38	sysdecode_enum.3 sysdecode_fadvice.3 \
39	sysdecode_enum.3 sysdecode_fcntl_cmd.3 \
40	sysdecode_enum.3 sysdecode_getfsstat_mode.3 \
41	sysdecode_enum.3 sysdecode_getrusage_who.3 \
42	sysdecode_enum.3 sysdecode_idtype.3 \
43	sysdecode_enum.3 sysdecode_ipproto.3 \
44	sysdecode_enum.3 sysdecode_kldsym_cmd.3 \
45	sysdecode_enum.3 sysdecode_kldunload_flags.3 \
46	sysdecode_enum.3 sysdecode_lio_listio_mode.3 \
47	sysdecode_enum.3 sysdecode_madvice.3 \
48	sysdecode_enum.3 sysdecode_minherit_flags.3 \
49	sysdecode_enum.3 sysdecode_msgctl_cmd.3 \
50	sysdecode_enum.3 sysdecode_nfssvc_flags.3 \
51	sysdecode_enum.3 sysdecode_pathconf_name.3 \
52	sysdecode_enum.3 sysdecode_prio_which.3 \
53	sysdecode_enum.3 sysdecode_procctl_cmd.3 \
54	sysdecode_enum.3 sysdecode_ptrace_request.3 \
55	sysdecode_enum.3 sysdecode_rlimit.3 \
56	sysdecode_enum.3 sysdecode_rtprio_function.3 \
57	sysdecode_enum.3 sysdecode_scheduler_policy.3 \
58	sysdecode_enum.3 sysdecode_sctp_pr_policy.3 \
59	sysdecode_enum.3 sysdecode_semctl_cmd.3 \
60	sysdecode_enum.3 sysdecode_shmctl_cmd.3 \
61	sysdecode_enum.3 sysdecode_shutdown_how.3 \
62	sysdecode_enum.3 sysdecode_sigbus_code.3 \
63	sysdecode_enum.3 sysdecode_sigchld_code.3 \
64	sysdecode_enum.3 sysdecode_sigfpe_code.3 \
65	sysdecode_enum.3 sysdecode_sigill_code.3 \
66	sysdecode_enum.3 sysdecode_signal.3 \
67	sysdecode_enum.3 sysdecode_sigprocmask_how.3 \
68	sysdecode_enum.3 sysdecode_sigsegv_code.3 \
69	sysdecode_enum.3 sysdecode_sigtrap_code.3 \
70	sysdecode_enum.3 sysdecode_sockaddr_family.3 \
71	sysdecode_enum.3 sysdecode_socketdomain.3 \
72	sysdecode_enum.3 sysdecode_sockettype.3 \
73	sysdecode_enum.3 sysdecode_sockopt_level.3 \
74	sysdecode_enum.3 sysdecode_sysarch_number.3 \
75	sysdecode_enum.3 sysdecode_umtx_op.3 \
76	sysdecode_enum.3 sysdecode_vmresult.3 \
77	sysdecode_enum.3 sysdecode_whence.3
78MLINKS+=sysdecode_fcntl_arg.3 sysdecode_fcntl_arg_p.3
79MLINKS+=sysdecode_kevent.3 sysdecode_kevent_fflags.3 \
80	sysdecode_kevent.3 sysdecode_kevent_filter.3 \
81	sysdecode_kevent.3 sysdecode_kevent_flags.3
82MLINKS+=sysdecode_mask.3 sysdecode_accessmode.3 \
83	sysdecode_mask.3 sysdecode_atflags.3 \
84	sysdecode_mask.3 sysdecode_capfcntlrights.3 \
85	sysdecode_mask.3 sysdecode_fcntl_fileflags.3 \
86	sysdecode_mask.3 sysdecode_fileflags.3 \
87	sysdecode_mask.3 sysdecode_filemode.3 \
88	sysdecode_mask.3 sysdecode_flock_operation.3 \
89	sysdecode_mask.3 sysdecode_mlockall_flags.3 \
90	sysdecode_mask.3 sysdecode_mmap_flags.3 \
91	sysdecode_mask.3 sysdecode_mmap_prot.3 \
92	sysdecode_mask.3 sysdecode_mount_flags.3 \
93	sysdecode_mask.3 sysdecode_msg_flags.3 \
94	sysdecode_mask.3 sysdecode_msync_flags.3 \
95	sysdecode_mask.3 sysdecode_open_flags.3 \
96	sysdecode_mask.3 sysdecode_pipe2_flags.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.if defined(COMPAT_32BIT)
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