# -*- Mode: makefile; indent-tabs-mode: t -*- # # This file is part of systemd. # # Copyright 2010-2012 Lennart Poettering # Copyright 2010-2012 Kay Sievers # Copyright 2013 Zbigniew Jędrzejewski-Szmek # Copyright 2013 David Strauss # Copyright 2016 Luke Shumaker # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # systemd is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see . include $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk $(outdir)/errno-list.txt: | $(outdir)/.deps $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include errno.h - $@ $(outdir)/errno-to-name.h: $(outdir)/errno-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@ $(outdir)/af-list.txt: $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include sys/socket.h - $@ $(outdir)/af-to-name.h: $(outdir)/af-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const af_names[] = { "} !/AF_FILE/ && !/AF_ROUTE/ && !/AF_LOCAL/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@ $(outdir)/arphrd-list.txt: $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include net/if_arp.h - $@ $(outdir)/arphrd-to-name.h: $(outdir)/arphrd-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const arphrd_names[] = { "} !/CISCO/ { printf "[ARPHRD_%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@ $(outdir)/arphrd-from-name.gperf: $(outdir)/arphrd-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct arphrd_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, ARPHRD_%s\n", $$1, $$1 }' <$< >$@ $(outdir)/cap-list.txt: $(srcdir)/missing.h $(AM_V_GEN)$(CPP) $(sd.ALL_CPPFLAGS) -dM -include linux/capability.h -include $< - $@ $(outdir)/cap-to-name.h: $(outdir)/cap-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const capability_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, tolower($$1) } END{print "};"}' <$< >$@ $(outdir)/cap-from-name.gperf: $(outdir)/cap-list.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct capability_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@ $(outdir)/cap-from-name.h: $(outdir)/cap-from-name.gperf $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_capability -H hash_capability_name -p -C <$< >$@ sd.CPPFLAGS += $(libbasic.CPPFLAGS) include $(topsrcdir)/build-aux/Makefile.tail.mk