-I $(top_srcdir)/src/timedate \
-I $(top_srcdir)/src/timesync \
-I $(top_srcdir)/src/resolve \
+ -I $(top_builddir)/src/resolve \
-I $(top_srcdir)/src/systemd \
-I $(top_builddir)/src/core \
-I $(top_srcdir)/src/core \
src/shared/errno-list.txt \
src/shared/errno-from-name.gperf \
src/shared/af-list.txt \
- src/shared/af-from-name.gperf
+ src/shared/af-from-name.gperf \
+ src/shared/dns_type-list.txt \
+ src/shared/dns_type-from-name.gperf
BUILT_SOURCES += \
src/shared/errno-from-name.h \
src/shared/errno-to-name.h \
src/shared/af-from-name.h \
- src/shared/af-to-name.h
+ src/shared/af-to-name.h \
+ src/resolve/dns_type-from-name.h \
+ src/resolve/dns_type-to-name.h
-src/shared/errno-list.txt:
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - < /dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' > $@
+%-from-name.gperf: %-list.txt
+ $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct $(notdir $*)_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
-src/shared/errno-from-name.gperf: src/shared/errno-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct errno_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' < $< > $@
+%-from-name.h: %-from-name.gperf
+ $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_$(notdir $*) -H hash_$(notdir $*)_name -p -C <$< >$@
-src/shared/errno-from-name.h: src/shared/errno-from-name.gperf
+
+src/shared/errno-list.txt:
$(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_errno -H hash_errno_name -p -C < $< > $@
+ $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - </dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' >$@
src/shared/errno-to-name.h: src/shared/errno-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' < $< > $@
+ $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
+
src/shared/af-list.txt:
$(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include sys/socket.h - < /dev/null | grep -v AF_UNSPEC | grep -v AF_MAX | $(AWK) '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $$2; }' > $@
+ $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include sys/socket.h - </dev/null | grep -v AF_UNSPEC | grep -v AF_MAX | $(AWK) '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $$2; }' >$@
-src/shared/af-from-name.gperf: src/shared/af-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct af_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' < $< > $@
+src/shared/af-to-name.h: src/shared/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 "};"}' <$< >$@
-src/shared/af-from-name.h: src/shared/af-from-name.gperf
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_af -H hash_af_name -p -C < $< > $@
-src/shared/af-to-name.h: src/shared/af-list.txt
+src/resolve/dns_type-list.txt: src/resolve/dns-type.h
$(AM_V_at)$(MKDIR_P) $(dir $@)
- $(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 "};"}' < $< > $@
+ $(AM_V_GEN)$(SED) -n -r 's/.* DNS_TYPE_(\w+).*/\1/p' <$< >$@
+
+src/resolve/dns_type-to-name.h: src/resolve/dns_type-list.txt
+ $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char *dns_type_to_string(int type) {\n\tswitch(type) {" } {printf " case DNS_TYPE_%s: return ", $$1; sub(/_/, "-"); printf "\"%s\";\n", $$1 } END{ print "\ndefault: return NULL;\n\t}\n}\n" }' <$< >$@
+
+src/resolve/dns_type-from-name.gperf: src/resolve/dns_type-list.txt
+ $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct dns_type_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { s=$$1; sub(/_/, "-", s); printf "%s, ", $$s; printf "DNS_TYPE_%s\n", $$1 }' <$< >$@
# ------------------------------------------------------------------------------
systemd_SOURCES = \
# ------------------------------------------------------------------------------
if ENABLE_RESOLVED
systemd_resolved_SOURCES = \
- src/resolve/resolved.h \
src/resolve/resolved.c \
src/resolve/resolved-manager.c \
+ src/resolve/resolved-manager.h \
src/resolve/resolved-conf.c \
src/resolve/resolved-conf.h \
src/resolve/resolved-bus.c \
+ src/resolve/resolved-bus.h \
src/resolve/resolved-link.h \
src/resolve/resolved-link.c \
src/resolve/resolved-dns-domain.h \
src/resolve/resolved-dns-zone.h \
src/resolve/resolved-dns-zone.c \
src/resolve/resolved-dns-stream.h \
- src/resolve/resolved-dns-stream.c
+ src/resolve/resolved-dns-stream.c \
+ src/resolve/dns-type.c \
+ src/resolve/dns-type.h \
+ src/resolve/dns_type-from-name.h \
+ src/resolve/dns_type-to-name.h
nodist_systemd_resolved_SOURCES = \
src/resolve/resolved-gperf.c
EXTRA_DIST += \
- src/resolve/resolved-gperf.gperf
+ src/resolve/resolved-gperf.gperf \
+ src/resolve/dns_type-from-name.gperf
CLEANFILES += \
src/resolve/resolved-gperf.c
src/resolve/resolved-dns-question.c \
src/resolve/resolved-dns-question.h \
src/resolve/resolved-dns-domain.c \
- src/resolve/resolved-dns-domain.h
+ src/resolve/resolved-dns-domain.h \
+ src/resolve/dns-type.c \
+ src/resolve/dns-type.h \
+ src/resolve/dns_type-from-name.h \
+ src/resolve/dns_type-to-name.h
systemd_resolve_host_LDADD = \
libsystemd-internal.la \