]> granicus.if.org Git - strace/blob - Makefile.am
Robustify mpers.awk against invalid input
[strace] / Makefile.am
1 # Automake input for strace.
2
3 if HAVE_M32_RUNTIME
4 TESTS_M32 = tests-m32
5 endif
6 if HAVE_MX32_RUNTIME
7 TESTS_MX32 = tests-mx32
8 endif
9 SUBDIRS = tests $(TESTS_M32) $(TESTS_MX32)
10
11 bin_PROGRAMS = strace
12 man_MANS = strace.1
13 bin_SCRIPTS = strace-graph strace-log-merge
14
15 OS              = linux
16 # ARCH is `i386', `m68k', `sparc', etc.
17 ARCH            = @arch@
18
19 ACLOCAL_AMFLAGS = -I m4
20 AM_CFLAGS = $(WARN_CFLAGS)
21 AM_CPPFLAGS = -I$(builddir)/$(OS)/$(ARCH) \
22               -I$(srcdir)/$(OS)/$(ARCH) \
23               -I$(builddir)/$(OS) \
24               -I$(srcdir)/$(OS) \
25               -I$(builddir) \
26               -I$(srcdir)
27
28 include xlat/Makemodule.am
29
30 strace_CPPFLAGS = $(AM_CPPFLAGS)
31 strace_LDFLAGS =
32 strace_LDADD =
33 noinst_LIBRARIES =
34
35 strace_SOURCES =        \
36         access.c        \
37         affinity.c      \
38         aio.c           \
39         bjm.c           \
40         block.c         \
41         bpf.c           \
42         cacheflush.c    \
43         capability.c    \
44         caps0.h         \
45         caps1.h         \
46         chdir.c         \
47         chmod.c         \
48         clone.c         \
49         count.c         \
50         desc.c          \
51         dirent.c        \
52         dirent64.c      \
53         empty.h         \
54         epoll.c         \
55         evdev.c         \
56         eventfd.c       \
57         execve.c        \
58         exit.c          \
59         fadvise.c       \
60         fallocate.c     \
61         fanotify.c      \
62         fchownat.c      \
63         fcntl.c         \
64         fetch_seccomp_fprog.c \
65         fetch_struct_flock.c \
66         file.c          \
67         file_handle.c   \
68         flock.c         \
69         flock.h         \
70         futex.c         \
71         get_robust_list.c \
72         getcpu.c        \
73         getcwd.c        \
74         getrandom.c     \
75         hostname.c      \
76         inotify.c       \
77         io.c            \
78         ioctl.c         \
79         ioperm.c        \
80         iopl.c          \
81         ioprio.c        \
82         ipc_defs.h      \
83         ipc_msg.c       \
84         ipc_msgctl.c    \
85         ipc_sem.c       \
86         ipc_shm.c       \
87         ipc_shmctl.c    \
88         kcmp.c          \
89         kernel_types.h  \
90         kexec.c         \
91         keyctl.c        \
92         ldt.c           \
93         link.c          \
94         linux/asm_stat.h \
95         linux/x32/asm_stat.h \
96         lookup_dcookie.c \
97         loop.c          \
98         lseek.c         \
99         mem.c           \
100         membarrier.c    \
101         memfd_create.c  \
102         mknod.c         \
103         mount.c         \
104         mpers_type.h    \
105         mq.c            \
106         mtd.c           \
107         native_defs.h   \
108         net.c           \
109         open.c          \
110         or1k_atomic.c   \
111         pathtrace.c     \
112         perf.c          \
113         personality.c   \
114         poll.c          \
115         prctl.c         \
116         print_mq_attr.c \
117         print_msgbuf.c  \
118         print_sigevent.c \
119         print_time.c    \
120         print_timex.c   \
121         printmode.c     \
122         printrusage.c   \
123         printsiginfo.c  \
124         printsiginfo.h  \
125         printstat.h     \
126         process.c       \
127         process_vm.c    \
128         ptp.c           \
129         ptrace.h        \
130         quota.c         \
131         readahead.c     \
132         readlink.c      \
133         reboot.c        \
134         regs.h          \
135         renameat.c      \
136         resource.c      \
137         rtc.c           \
138         sched.c         \
139         scsi.c          \
140         seccomp.c       \
141         seccomp_fprog.h \
142         sendfile.c      \
143         sigaltstack.c   \
144         signal.c        \
145         signalfd.c      \
146         sigreturn.c     \
147         sock.c          \
148         socketutils.c   \
149         sram_alloc.c    \
150         statfs.c        \
151         strace.c        \
152         swapon.c        \
153         sync_file_range.c \
154         syscall.c       \
155         sysctl.c        \
156         sysinfo.c       \
157         syslog.c        \
158         sysmips.c       \
159         term.c          \
160         time.c          \
161         times.c         \
162         truncate.c      \
163         uid.c           \
164         uid16.c         \
165         umask.c         \
166         umount.c        \
167         uname.c         \
168         userfaultfd.c   \
169         util.c          \
170         utime.c         \
171         utimes.c        \
172         v4l2.c          \
173         vsprintf.c      \
174         wait.c          \
175         xattr.c         \
176         xmalloc.c       \
177         # end of strace_SOURCES
178
179 if USE_LIBUNWIND
180 strace_SOURCES += unwind.c
181 strace_CPPFLAGS += $(libunwind_CPPFLAGS)
182 strace_LDFLAGS += $(libunwind_LDFLAGS)
183 strace_LDADD += $(libunwind_LIBS)
184 endif
185
186 noinst_HEADERS = defs.h
187 # Enable this to get link map generated
188 #strace_CFLAGS = $(AM_CFLAGS) -Wl,-Map=strace.mapfile
189
190 EXTRA_DIST =                            \
191         $(man_MANS)                     \
192         .version                        \
193         COPYING                         \
194         CREDITS                         \
195         ChangeLog                       \
196         ChangeLog-CVS                   \
197         README-linux-ptrace             \
198         debian/changelog                \
199         debian/compat                   \
200         debian/control                  \
201         debian/copyright                \
202         debian/rules                    \
203         debian/source/format            \
204         debian/strace-udeb.install      \
205         debian/strace.docs              \
206         debian/strace.examples          \
207         debian/strace.install           \
208         debian/strace.manpages          \
209         debian/strace64.install         \
210         debian/strace64.manpages        \
211         debian/watch                    \
212         errnoent.sh                     \
213         generate_sen.sh                 \
214         ioctlsort.c                     \
215         linux/32/ioctls_inc.h           \
216         linux/32/ioctls_inc_align32.h   \
217         linux/32/ioctls_inc_align64.h   \
218         linux/32/syscallent.h           \
219         linux/64/ioctls_inc.h           \
220         linux/64/syscallent.h           \
221         linux/aarch64/arch_regs.c       \
222         linux/aarch64/arch_regs.h       \
223         linux/aarch64/arch_sigreturn.c  \
224         linux/aarch64/errnoent1.h       \
225         linux/aarch64/get_error.c       \
226         linux/aarch64/get_scno.c        \
227         linux/aarch64/get_syscall_args.c\
228         linux/aarch64/ioctls_arch0.h    \
229         linux/aarch64/ioctls_arch1.h    \
230         linux/aarch64/ioctls_inc0.h     \
231         linux/aarch64/ioctls_inc1.h     \
232         linux/aarch64/signalent1.h      \
233         linux/aarch64/syscallent.h      \
234         linux/aarch64/syscallent1.h     \
235         linux/alpha/arch_getrval2.c     \
236         linux/alpha/arch_regs.c         \
237         linux/alpha/arch_regs.h         \
238         linux/alpha/arch_sigreturn.c    \
239         linux/alpha/errnoent.h          \
240         linux/alpha/get_error.c         \
241         linux/alpha/get_scno.c          \
242         linux/alpha/get_syscall_args.c  \
243         linux/alpha/get_syscall_result.c\
244         linux/alpha/ioctls_arch0.h      \
245         linux/alpha/ioctls_inc0.h       \
246         linux/alpha/signalent.h         \
247         linux/alpha/syscallent.h        \
248         linux/alpha/userent.h           \
249         linux/arc/arch_regs.c           \
250         linux/arc/get_error.c           \
251         linux/arc/get_scno.c            \
252         linux/arc/get_syscall_args.c    \
253         linux/arc/ioctls_arch0.h        \
254         linux/arc/ioctls_inc0.h         \
255         linux/arc/syscallent.h          \
256         linux/arch_regs.h               \
257         linux/arch_sigreturn.c          \
258         linux/arm/arch_regs.c           \
259         linux/arm/arch_regs.h           \
260         linux/arm/arch_sigreturn.c      \
261         linux/arm/get_error.c           \
262         linux/arm/get_scno.c            \
263         linux/arm/get_syscall_args.c    \
264         linux/arm/ioctls_arch0.h        \
265         linux/arm/ioctls_inc0.h         \
266         linux/arm/syscallent.h          \
267         linux/arm/userent.h             \
268         linux/avr32/arch_regs.c         \
269         linux/avr32/get_error.c         \
270         linux/avr32/get_scno.c          \
271         linux/avr32/get_syscall_args.c  \
272         linux/avr32/ioctls_arch0.h      \
273         linux/avr32/ioctls_inc0.h       \
274         linux/avr32/syscallent.h        \
275         linux/avr32/userent.h           \
276         linux/bfin/arch_regs.c          \
277         linux/bfin/get_error.c          \
278         linux/bfin/get_scno.c           \
279         linux/bfin/get_syscall_args.c   \
280         linux/bfin/get_syscall_result.c \
281         linux/bfin/ioctls_arch0.h       \
282         linux/bfin/ioctls_inc0.h        \
283         linux/bfin/syscallent.h         \
284         linux/bfin/userent.h            \
285         linux/crisv10/arch_regs.c       \
286         linux/crisv10/arch_sigreturn.c  \
287         linux/crisv10/get_error.c       \
288         linux/crisv10/get_scno.c        \
289         linux/crisv10/get_syscall_args.c        \
290         linux/crisv10/get_syscall_result.c      \
291         linux/crisv10/userent.h         \
292         linux/crisv32/arch_regs.c       \
293         linux/crisv32/arch_sigreturn.c  \
294         linux/crisv32/get_error.c       \
295         linux/crisv32/get_scno.c        \
296         linux/crisv32/get_syscall_args.c        \
297         linux/crisv32/get_syscall_result.c      \
298         linux/crisv32/userent.h         \
299         linux/dummy.h                   \
300         linux/errnoent.h                \
301         linux/hppa/arch_regs.c          \
302         linux/hppa/arch_regs.h          \
303         linux/hppa/errnoent.h           \
304         linux/hppa/get_error.c          \
305         linux/hppa/get_scno.c           \
306         linux/hppa/get_syscall_args.c   \
307         linux/hppa/get_syscall_result.c \
308         linux/hppa/ioctls_arch0.h       \
309         linux/hppa/ioctls_inc0.h        \
310         linux/hppa/signalent.h          \
311         linux/hppa/syscallent.h         \
312         linux/i386/arch_regs.c          \
313         linux/i386/arch_regs.h          \
314         linux/i386/arch_sigreturn.c     \
315         linux/i386/get_error.c          \
316         linux/i386/get_scno.c           \
317         linux/i386/get_syscall_args.c   \
318         linux/i386/ioctls_arch0.h       \
319         linux/i386/ioctls_inc0.h        \
320         linux/i386/syscallent.h         \
321         linux/i386/userent.h            \
322         linux/i386/userent0.h           \
323         linux/ia64/arch_getrval2.c      \
324         linux/ia64/arch_regs.c          \
325         linux/ia64/arch_regs.h          \
326         linux/ia64/arch_sigreturn.c     \
327         linux/ia64/get_error.c          \
328         linux/ia64/get_scno.c           \
329         linux/ia64/get_syscall_args.c   \
330         linux/ia64/ioctls_arch0.h       \
331         linux/ia64/ioctls_inc0.h        \
332         linux/ia64/syscallent.h         \
333         linux/ia64/userent.h            \
334         linux/inet_diag.h               \
335         linux/m68k/arch_regs.c          \
336         linux/m68k/arch_sigreturn.c     \
337         linux/m68k/get_error.c          \
338         linux/m68k/get_scno.c           \
339         linux/m68k/get_syscall_args.c   \
340         linux/m68k/get_syscall_result.c \
341         linux/m68k/ioctls_arch0.h       \
342         linux/m68k/ioctls_inc0.h        \
343         linux/m68k/syscallent.h         \
344         linux/m68k/userent.h            \
345         linux/metag/arch_regs.c         \
346         linux/metag/get_error.c         \
347         linux/metag/get_scno.c          \
348         linux/metag/get_syscall_args.c  \
349         linux/metag/ioctls_arch0.h      \
350         linux/metag/ioctls_inc0.h       \
351         linux/metag/syscallent.h        \
352         linux/microblaze/arch_regs.c    \
353         linux/microblaze/arch_sigreturn.c       \
354         linux/microblaze/get_error.c    \
355         linux/microblaze/get_scno.c     \
356         linux/microblaze/get_syscall_args.c     \
357         linux/microblaze/get_syscall_result.c   \
358         linux/microblaze/ioctls_arch0.h \
359         linux/microblaze/ioctls_inc0.h  \
360         linux/microblaze/syscallent.h   \
361         linux/microblaze/userent.h      \
362         linux/mips/arch_getrval2.c      \
363         linux/mips/arch_regs.c          \
364         linux/mips/arch_regs.h          \
365         linux/mips/arch_sigreturn.c     \
366         linux/mips/errnoent.h           \
367         linux/mips/genstub.sh           \
368         linux/mips/get_error.c          \
369         linux/mips/get_scno.c           \
370         linux/mips/get_syscall_args.c   \
371         linux/mips/ioctls_arch0.h       \
372         linux/mips/ioctls_inc0.h        \
373         linux/mips/signalent.h          \
374         linux/mips/syscallent-compat.h  \
375         linux/mips/syscallent-n32.h     \
376         linux/mips/syscallent-n64.h     \
377         linux/mips/syscallent-o32.h     \
378         linux/mips/syscallent.h         \
379         linux/mips/userent.h            \
380         linux/mtd-abi.h                 \
381         linux/nios2/arch_regs.c         \
382         linux/nios2/get_error.c         \
383         linux/nios2/get_scno.c          \
384         linux/nios2/get_syscall_args.c  \
385         linux/nios2/ioctls_arch0.h      \
386         linux/nios2/ioctls_inc0.h       \
387         linux/nios2/syscallent.h        \
388         linux/or1k/arch_regs.c          \
389         linux/or1k/get_error.c          \
390         linux/or1k/get_scno.c           \
391         linux/or1k/get_syscall_args.c   \
392         linux/or1k/ioctls_arch0.h       \
393         linux/or1k/ioctls_inc0.h        \
394         linux/or1k/syscallent.h         \
395         linux/or1k/userent.h            \
396         linux/personality.h             \
397         linux/powerpc/arch_regs.c       \
398         linux/powerpc/arch_regs.h       \
399         linux/powerpc/arch_sigreturn.c  \
400         linux/powerpc/errnoent.h        \
401         linux/powerpc/get_error.c       \
402         linux/powerpc/get_scno.c        \
403         linux/powerpc/get_syscall_args.c        \
404         linux/powerpc/getregs_old.c     \
405         linux/powerpc/ioctls_arch0.h    \
406         linux/powerpc/ioctls_inc0.h     \
407         linux/powerpc/syscallent.h      \
408         linux/powerpc/userent.h         \
409         linux/powerpc64/arch_regs.c     \
410         linux/powerpc64/arch_regs.h     \
411         linux/powerpc64/arch_sigreturn.c        \
412         linux/powerpc64/errnoent.h      \
413         linux/powerpc64/errnoent1.h     \
414         linux/powerpc64/get_error.c     \
415         linux/powerpc64/get_scno.c      \
416         linux/powerpc64/get_syscall_args.c      \
417         linux/powerpc64/getregs_old.c   \
418         linux/powerpc64/ioctls_arch0.h  \
419         linux/powerpc64/ioctls_arch1.h  \
420         linux/powerpc64/ioctls_inc0.h   \
421         linux/powerpc64/ioctls_inc1.h   \
422         linux/powerpc64/signalent1.h    \
423         linux/powerpc64/syscallent.h    \
424         linux/powerpc64/syscallent1.h   \
425         linux/powerpc64/userent.h       \
426         linux/ptp_clock.h               \
427         linux/s390/arch_regs.c          \
428         linux/s390/arch_regs.h          \
429         linux/s390/arch_sigreturn.c     \
430         linux/s390/get_error.c          \
431         linux/s390/get_scno.c           \
432         linux/s390/get_syscall_args.c   \
433         linux/s390/ioctls_arch0.h       \
434         linux/s390/ioctls_inc0.h        \
435         linux/s390/syscallent.h         \
436         linux/s390/userent.h            \
437         linux/s390/userent0.h           \
438         linux/s390/userent1.h           \
439         linux/s390x/arch_regs.c         \
440         linux/s390x/arch_regs.h         \
441         linux/s390x/arch_sigreturn.c    \
442         linux/s390x/get_error.c         \
443         linux/s390x/get_scno.c          \
444         linux/s390x/get_syscall_args.c  \
445         linux/s390x/ioctls_arch0.h      \
446         linux/s390x/ioctls_inc0.h       \
447         linux/s390x/syscallent.h        \
448         linux/s390x/userent.h           \
449         linux/sh/arch_getrval2.c        \
450         linux/sh/arch_regs.c            \
451         linux/sh/get_error.c            \
452         linux/sh/get_scno.c             \
453         linux/sh/get_syscall_args.c     \
454         linux/sh/get_syscall_result.c   \
455         linux/sh/ioctls_arch0.h         \
456         linux/sh/ioctls_inc0.h          \
457         linux/sh/syscallent.h           \
458         linux/sh/userent.h              \
459         linux/sh/userent0.h             \
460         linux/sh64/arch_regs.c          \
461         linux/sh64/arch_regs.h          \
462         linux/sh64/get_error.c          \
463         linux/sh64/get_scno.c           \
464         linux/sh64/get_syscall_args.c   \
465         linux/sh64/get_syscall_result.c \
466         linux/sh64/ioctls_arch0.h       \
467         linux/sh64/ioctls_inc0.h        \
468         linux/sh64/syscallent.h         \
469         linux/sh64/userent.h            \
470         linux/signalent.h               \
471         linux/sock_diag.h               \
472         linux/sparc/arch_getrval2.c     \
473         linux/sparc/arch_regs.c         \
474         linux/sparc/arch_regs.h         \
475         linux/sparc/arch_sigreturn.c    \
476         linux/sparc/errnoent.h          \
477         linux/sparc/gen.pl              \
478         linux/sparc/get_error.c         \
479         linux/sparc/get_scno.c          \
480         linux/sparc/get_syscall_args.c  \
481         linux/sparc/ioctls_arch0.h      \
482         linux/sparc/ioctls_inc0.h       \
483         linux/sparc/signalent.h         \
484         linux/sparc/syscallent.h        \
485         linux/sparc/userent.h           \
486         linux/sparc64/arch_getrval2.c   \
487         linux/sparc64/arch_regs.c       \
488         linux/sparc64/arch_regs.h       \
489         linux/sparc64/arch_sigreturn.c  \
490         linux/sparc64/errnoent.h        \
491         linux/sparc64/errnoent1.h       \
492         linux/sparc64/get_error.c       \
493         linux/sparc64/get_scno.c        \
494         linux/sparc64/get_syscall_args.c\
495         linux/sparc64/ioctls_arch0.h    \
496         linux/sparc64/ioctls_arch1.h    \
497         linux/sparc64/ioctls_inc0.h     \
498         linux/sparc64/ioctls_inc1.h     \
499         linux/sparc64/signalent.h       \
500         linux/sparc64/signalent1.h      \
501         linux/sparc64/syscallent.h      \
502         linux/sparc64/syscallent1.h     \
503         linux/sparc64/userent.h         \
504         linux/subcall.h                 \
505         linux/syscall.h                 \
506         linux/tile/arch_regs.c          \
507         linux/tile/arch_regs.h          \
508         linux/tile/arch_sigreturn.c     \
509         linux/tile/errnoent1.h          \
510         linux/tile/get_error.c          \
511         linux/tile/get_scno.c           \
512         linux/tile/get_syscall_args.c   \
513         linux/tile/ioctls_arch0.h       \
514         linux/tile/ioctls_arch1.h       \
515         linux/tile/ioctls_inc0.h        \
516         linux/tile/ioctls_inc1.h        \
517         linux/tile/signalent1.h         \
518         linux/tile/syscallent.h         \
519         linux/tile/syscallent1.h        \
520         linux/tile/userent.h            \
521         linux/ubi-user.h                \
522         linux/unix_diag.h               \
523         linux/userent.h                 \
524         linux/userent0.h                \
525         linux/x32/arch_regs.c           \
526         linux/x32/arch_regs.h           \
527         linux/x32/arch_sigreturn.c      \
528         linux/x32/errnoent1.h           \
529         linux/x32/get_error.c           \
530         linux/x32/get_scno.c            \
531         linux/x32/get_syscall_args.c    \
532         linux/x32/ioctls_arch0.h        \
533         linux/x32/ioctls_arch1.h        \
534         linux/x32/ioctls_inc0.h         \
535         linux/x32/ioctls_inc1.h         \
536         linux/x32/signalent1.h          \
537         linux/x32/syscallent.h          \
538         linux/x32/syscallent1.h         \
539         linux/x32/userent.h             \
540         linux/x86_64/arch_regs.c        \
541         linux/x86_64/arch_regs.h        \
542         linux/x86_64/arch_sigreturn.c   \
543         linux/x86_64/errnoent1.h        \
544         linux/x86_64/errnoent2.h        \
545         linux/x86_64/gentab.pl          \
546         linux/x86_64/get_error.c        \
547         linux/x86_64/get_scno.c         \
548         linux/x86_64/get_syscall_args.c \
549         linux/x86_64/getregs_old.c      \
550         linux/x86_64/ioctls_arch0.h     \
551         linux/x86_64/ioctls_arch1.h     \
552         linux/x86_64/ioctls_arch2.h     \
553         linux/x86_64/ioctls_inc0.h      \
554         linux/x86_64/ioctls_inc1.h      \
555         linux/x86_64/ioctls_inc2.h      \
556         linux/x86_64/signalent1.h       \
557         linux/x86_64/signalent2.h       \
558         linux/x86_64/syscallent.h       \
559         linux/x86_64/syscallent1.h      \
560         linux/x86_64/syscallent2.h      \
561         linux/x86_64/userent.h          \
562         linux/xtensa/arch_regs.c        \
563         linux/xtensa/get_error.c        \
564         linux/xtensa/get_scno.c         \
565         linux/xtensa/get_syscall_args.c \
566         linux/xtensa/get_syscall_result.c       \
567         linux/xtensa/ioctls_arch0.h     \
568         linux/xtensa/ioctls_inc0.h      \
569         linux/xtensa/syscallent.h       \
570         linux/xtensa/userent.h          \
571         maint/ioctls_gen.sh             \
572         maint/ioctls_hex.sh             \
573         maint/ioctls_sym.sh             \
574         maint/print_ioctlent.c          \
575         mpers.awk                       \
576         mpers.sh                        \
577         mpers_test.sh                   \
578         mpers_xlat.h                    \
579         signalent.sh                    \
580         strace-graph                    \
581         strace-log-merge                \
582         strace.spec                     \
583         syscallent.sh                   \
584         $(XLAT_INPUT_FILES)             \
585         $(XLAT_HEADER_FILES)            \
586         xlat/gen.sh                     \
587         xlate.el
588
589 .PHONY: srpm
590 srpm: dist-xz
591         rpmbuild --define '%_srcrpmdir .' -ts $(distdir).tar.xz
592
593 $(srcdir)/.version:
594         $(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
595
596 strace_SOURCES_c = $(filter %.c,$(strace_SOURCES))
597
598 sys_func.h: $(patsubst %,$(srcdir)/%,$(strace_SOURCES_c))
599         for f in $^; do \
600                 sed -n 's/^SYS_FUNC(.*/extern &;/p' $$f; \
601         done | sort -u > $@
602
603 syscallent_names = subcall.h syscallent.h syscallent1.h \
604                    syscallent-n32.h syscallent-n64.h syscallent-o32.h
605 syscallent_patterns = $(patsubst %,\%/%,$(syscallent_names))
606 syscallent_files = $(filter $(syscallent_patterns),$(EXTRA_DIST))
607
608 sen.h: $(patsubst %,$(srcdir)/%,$(syscallent_files))
609         for f in $^; do cat -- $$f; done | \
610                 $(srcdir)/generate_sen.sh > $@
611
612 dist-hook:
613         $(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
614
615 today = $(shell date +%Y-%m-%d)
616 version_regexp = $(subst .,\.,$(VERSION))
617 news_check_regexp = 'Noteworthy changes in release $(version_regexp) ($(today))'
618
619 news-check: NEWS
620         $(AM_V_GEN)if head -1 $< |                              \
621           grep -x $(news_check_regexp) >/dev/null; then         \
622                 :;                                              \
623         else                                                    \
624                 echo >&2 '$<: check failed';                    \
625                 exit 1;                                         \
626         fi
627
628 ioctlsort_CC = $(CC_FOR_BUILD)
629 ioctlsort_DEFS = $(DEFS)
630 ioctlsort_INCLUDES = $(DEFAULT_INCLUDES) $(INCLUDES)
631 ioctlsort_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_FOR_BUILD)
632 ioctlsort_CFLAGS = $(AM_CFLAGS) $(CFLAGS_FOR_BUILD)
633 ioctlsort_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD)
634
635 ioctls_inc_h = $(wildcard $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h)
636 ioctlent_h = $(patsubst $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%,ioctlent%,$(ioctls_inc_h))
637
638 ioctlent%.h: ioctlsort%
639         ./$< > $@
640
641 ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
642         $(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
643
644 ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
645         $(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
646
647 ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
648         cat $^ > $@
649
650 BUILT_SOURCES = $(ioctlent_h) native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h .version
651 CLEANFILES    = $(ioctlent_h) native_printer_decls.h native_printer_defs.h printers.h sen.h sys_func.h
652 DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
653
654 # defines mpers_source_files
655 include mpers.am
656 srcdir_mpers_source_files = $(patsubst %,$(srcdir)/%,$(mpers_source_files))
657
658 mpers_NAME =
659 mpers_PREFIX = $(mpers_NAME)_
660 mpers_DEFS = $(DEFS)
661 mpers_INCLUDES = $(DEFAULT_INCLUDES) $(INCLUDES)
662 mpers_CPPFLAGS = $(strace_CPPFLAGS) $(CPPFLAGS)
663 mpers_sh_opts = $(mpers_DEFS) $(mpers_INCLUDES) $(mpers_CPPFLAGS)
664 libmpers_CPPFLAGS = $(AM_CPPFLAGS) -DIN_MPERS
665
666 # mpers targets
667
668 mpers-m%.stamp: $(srcdir_mpers_source_files) | printers.h
669         for f in $^; do \
670                 CC="$(CC)" CFLAGS="$(mpers_sh_opts)" \
671                 CPP="$(CPP)" CPPFLAGS="$(mpers_sh_opts) -DIN_MPERS -DMPERS_IS_$(mpers_NAME)" \
672                 $(srcdir)/mpers.sh -$(mpers_NAME) $$f || exit; \
673         done
674         > $@
675
676 m%_type_defs.h: $(srcdir_mpers_source_files)
677         for f in $^; do \
678                 sed -n 's/^#include DEF_MPERS_TYPE(\([^)]\+\))/#ifdef MPERS_$(mpers_PREFIX)\1\n# define \1 MPERS_$(mpers_PREFIX)\1\n#endif/p' $$f || exit; \
679         done > $@-t
680         echo '#undef MPERS_PRINTER_NAME' >> $@-t
681         echo '#define MPERS_PRINTER_NAME(printer_name) printer_name' >> $@-t
682         echo '#include "$(mpers_PREFIX)printer_decls.h"' >> $@-t
683         mv $@-t $@
684
685 m%_funcs.h: $(srcdir_mpers_source_files)
686         for f in $^; do \
687                 sed -n 's/^SYS_FUNC(\([^)]\+\))/#undef sys_\1\n#define sys_\1 $(mpers_PREFIX)sys_\1/p' $$f || exit; \
688         done > $@-t && \
689         echo '#include "sys_func.h"' >> $@-t
690         mv $@-t $@
691
692 # printers
693
694 printers.h: $(srcdir_mpers_source_files)
695         echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
696         echo 'typedef struct {' >> $@-t
697         for f in $^; do \
698                 sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/ \1 (*\2) \3;\n#define \2 MPERS_PRINTER_NAME(\2)\n/p' $$f || exit; \
699         done >> $@-t
700         echo '} struct_printers;' >> $@-t
701         echo 'extern const struct_printers *printers;' >> $@-t
702         echo '#define MPERS_PRINTER_NAME(printer_name) printers->printer_name' >> $@-t
703         mv $@-t $@
704
705 %_printer_decls.h: $(srcdir_mpers_source_files)
706         echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
707         for f in $^; do \
708                 sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/extern \1 $(mpers_PREFIX)\2\3;/p' $$f || exit; \
709         done >> $@-t
710         mv $@-t $@
711
712 %_printer_defs.h: $(srcdir_mpers_source_files)
713         echo '/* Generated by Makefile from $^; do not edit. */' > $@-t
714         for f in $^; do \
715                 sed -n 's/^MPERS_PRINTER_DECL(\([^,]\+\),[[:space:]]*\([^)]\+\))\(.*\)/\.\2 = $(mpers_PREFIX)\2,/p' $$f || exit; \
716         done >> $@-t
717         mv $@-t $@
718
719 native_printer_decls.h native_printer_defs.h: mpers_PREFIX =
720
721 if HAVE_M32_MPERS
722
723 strace_LDADD += libmpers-m32.a
724 noinst_LIBRARIES += libmpers-m32.a
725 libmpers_m32_a_SOURCES = $(mpers_source_files)
726 libmpers_m32_a_CPPFLAGS = $(libmpers_CPPFLAGS) -DMPERS_IS_m32 -I$(builddir)/mpers-m32
727 mpers_m32_targets = mpers-m32.stamp m32_type_defs.h m32_funcs.h m32_printer_decls.h m32_printer_defs.h
728
729 BUILT_SOURCES += $(mpers_m32_targets)
730 CLEANFILES    += $(mpers_m32_targets)
731
732 $(mpers_m32_targets): mpers_NAME = m32
733
734 endif # HAVE_M32_MPERS
735
736 if HAVE_MX32_MPERS
737
738 strace_LDADD += libmpers-mx32.a
739 noinst_LIBRARIES += libmpers-mx32.a
740 libmpers_mx32_a_SOURCES = $(mpers_source_files)
741 libmpers_mx32_a_CPPFLAGS = $(libmpers_CPPFLAGS) -DMPERS_IS_mx32 -I$(builddir)/mpers-mx32
742 mpers_mx32_targets = mpers-mx32.stamp mx32_type_defs.h mx32_funcs.h mx32_printer_decls.h mx32_printer_defs.h
743
744 BUILT_SOURCES += $(mpers_mx32_targets)
745 CLEANFILES    += $(mpers_mx32_targets)
746
747 $(mpers_mx32_targets): mpers_NAME = mx32
748
749 endif # HAVE_MX32_MPERS
750
751 clean-local:
752         -rm -rf mpers-m32 mpers-mx32
753
754 if MAINTAINER_MODE
755
756 gen_changelog_start_date = 2009-07-08 20:00
757 $(srcdir)/ChangeLog: $(srcdir)/gitlog-to-changelog $(srcdir)/Makefile.in \
758                      $(srcdir)/.version
759         @rm -f $@.new
760         (cd $(srcdir); \
761          ./gitlog-to-changelog --append-dot \
762            --since='$(gen_changelog_start_date)'; \
763          echo; echo; echo 'See ChangeLog-CVS for older changes.' \
764         ) > $@.new
765         chmod 444 $@.new
766         mv -f $@.new $@
767
768 $(srcdir)/CREDITS: $(srcdir)/CREDITS.in $(srcdir)/.mailmap \
769                    $(srcdir)/Makefile.in $(srcdir)/.version
770         $(AM_V_GEN)                                                     \
771         (                                                               \
772           cd $(srcdir);                                                 \
773           sed '/^##/,$$d' CREDITS.in;                                   \
774           { sed -n '1,/^##>/d; s/  \+/\t/; s/^./&/p' CREDITS.in;        \
775             git log --pretty=format:'%aN        %aE';                   \
776           } | LC_ALL=C sort -u                                          \
777             | awk -F'\t' '{printf("\t%s <%s>\n",$$1,$$2)}';             \
778         ) > $@-t && mv $@-t $@
779
780 export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner --mode=go-w,go+rX
781
782 endif