Annotation of embedaddon/dnsmasq/Makefile, revision 1.1.1.5

1.1.1.5 ! misho       1: # dnsmasq is Copyright (c) 2000-2022 Simon Kelley
1.1       misho       2: #
                      3: #  This program is free software; you can redistribute it and/or modify
                      4: #  it under the terms of the GNU General Public License as published by
                      5: #  the Free Software Foundation; version 2 dated June, 1991, or
                      6: #  (at your option) version 3 dated 29 June, 2007.
                      7: #
                      8: #  This program is distributed in the hope that it will be useful,
                      9: #  but WITHOUT ANY WARRANTY; without even the implied warranty of
                     10: #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     11: #  GNU General Public License for more details.
                     12: #    
                     13: #  You should have received a copy of the GNU General Public License
                     14: #  along with this program.  If not, see <http://www.gnu.org/licenses/>.
                     15: 
                     16: # NOTE: Building the i18n targets requires GNU-make 
                     17: 
                     18: 
                     19: # Variables you may well want to override.
                     20: 
                     21: PREFIX        = /usr/local
                     22: BINDIR        = $(PREFIX)/sbin
                     23: MANDIR        = $(PREFIX)/share/man
                     24: LOCALEDIR     = $(PREFIX)/share/locale
                     25: BUILDDIR      = $(SRC)
                     26: DESTDIR       = 
                     27: CFLAGS        = -Wall -W -O2
                     28: LDFLAGS       = 
                     29: COPTS         = 
                     30: RPM_OPT_FLAGS = 
                     31: LIBS          = 
                     32: 
                     33: #################################################################
                     34: 
                     35: # Variables you might want to override.
                     36: 
                     37: PKG_CONFIG = pkg-config
                     38: INSTALL    = install
                     39: MSGMERGE   = msgmerge
                     40: MSGFMT     = msgfmt
                     41: XGETTEXT   = xgettext
                     42: 
                     43: SRC = src
                     44: PO  = po
                     45: MAN = man
                     46: 
                     47: #################################################################
                     48: 
                     49: # pmake way. (NB no spaces to keep gmake 3.82 happy)
                     50: top!=pwd
                     51: # GNU make way.
                     52: top?=$(CURDIR)
                     53: 
1.1.1.2   misho      54: dbus_cflags =   `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --cflags dbus-1` 
                     55: dbus_libs =     `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DBUS $(PKG_CONFIG) --libs dbus-1` 
1.1.1.4   misho      56: ubus_libs =     `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_UBUS "" --copy '-lubox -lubus'`
1.1.1.2   misho      57: idn_cflags =    `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --cflags libidn` 
                     58: idn_libs =      `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --libs libidn` 
1.1.1.4   misho      59: idn2_cflags =   `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFIG) --cflags libidn2`
                     60: idn2_libs =     `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LIBIDN2 $(PKG_CONFIG) --libs libidn2`
1.1.1.2   misho      61: ct_cflags =     `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --cflags libnetfilter_conntrack`
                     62: ct_libs =       `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --libs libnetfilter_conntrack`
1.1.1.4   misho      63: lua_cflags =    `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --cflags lua5.2` 
                     64: lua_libs =      `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua5.2` 
                     65: nettle_cflags = `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC     $(PKG_CONFIG) --cflags 'nettle hogweed' \
                     66:                                                         HAVE_CRYPTOHASH $(PKG_CONFIG) --cflags nettle \
                     67:                                                         HAVE_NETTLEHASH $(PKG_CONFIG) --cflags nettle`
                     68: nettle_libs =   `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC     $(PKG_CONFIG) --libs 'nettle hogweed' \
                     69:                                                         HAVE_CRYPTOHASH $(PKG_CONFIG) --libs nettle \
                     70:                                                         HAVE_NETTLEHASH $(PKG_CONFIG) --libs nettle`
1.1.1.3   misho      71: gmp_libs =      `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_DNSSEC NO_GMP --copy -lgmp`
1.1.1.2   misho      72: sunos_libs =    `if uname | grep SunOS >/dev/null 2>&1; then echo -lsocket -lnsl -lposix4; fi`
1.1.1.5 ! misho      73: nft_cflags =    `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_NFTSET $(PKG_CONFIG) --cflags libnftables` 
        !            74: nft_libs =      `echo $(COPTS) | $(top)/bld/pkg-wrapper HAVE_NFTSET $(PKG_CONFIG) --libs libnftables`
        !            75: version =       -DVERSION='\"`$(top)/bld/get-version $(top)`\"'
1.1       misho      76: 
1.1.1.3   misho      77: sum?=$(shell $(CC) -DDNSMASQ_COMPILE_OPTS $(COPTS) -E $(top)/$(SRC)/dnsmasq.h | ( md5sum 2>/dev/null || md5 ) | cut -f 1 -d ' ')
                     78: sum!=$(CC) -DDNSMASQ_COMPILE_OPTS $(COPTS) -E $(top)/$(SRC)/dnsmasq.h | ( md5sum 2>/dev/null || md5 ) | cut -f 1 -d ' '
                     79: copts_conf = .copts_$(sum)
                     80: 
1.1       misho      81: objs = cache.o rfc1035.o util.o option.o forward.o network.o \
                     82:        dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o \
                     83:        helper.o tftp.o log.o conntrack.o dhcp6.o rfc3315.o \
1.1.1.5 ! misho      84:        dhcp-common.o outpacket.o radv.o slaac.o auth.o ipset.o pattern.o \
1.1.1.3   misho      85:        domain.o dnssec.o blockdata.o tables.o loop.o inotify.o \
1.1.1.4   misho      86:        poll.o rrfilter.o edns0.o arp.o crypto.o dump.o ubus.o \
1.1.1.5 ! misho      87:        metrics.o hash-questions.o domain-match.o nftset.o
1.1       misho      88: 
                     89: hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
1.1.1.4   misho      90:        dns-protocol.h radv-protocol.h ip6addr.h metrics.h
1.1       misho      91: 
                     92: all : $(BUILDDIR)
                     93:        @cd $(BUILDDIR) && $(MAKE) \
                     94:  top="$(top)" \
1.1.1.5 ! misho      95:  build_cflags="$(version) $(dbus_cflags) $(idn2_cflags) $(idn_cflags) $(ct_cflags) $(lua_cflags) $(nettle_cflags) $(nft_cflags)" \
        !            96:  build_libs="$(dbus_libs) $(idn2_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs) $(nettle_libs) $(gmp_libs) $(ubus_libs) $(nft_libs)" \
1.1       misho      97:  -f $(top)/Makefile dnsmasq 
                     98: 
1.1.1.2   misho      99: mostly_clean :
                    100:        rm -f $(BUILDDIR)/*.mo $(BUILDDIR)/*.pot 
1.1.1.3   misho     101:        rm -f $(BUILDDIR)/.copts_* $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq
1.1.1.2   misho     102: 
                    103: clean : mostly_clean
                    104:        rm -f $(BUILDDIR)/dnsmasq_baseline
                    105:        rm -f core */core
                    106:        rm -f *~ contrib/*/*~ */*~
1.1       misho     107: 
                    108: install : all install-common
                    109: 
                    110: install-common :
1.1.1.4   misho     111:        $(INSTALL) -d $(DESTDIR)$(BINDIR)
                    112:        $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8
1.1       misho     113:        $(INSTALL) -m 644 $(MAN)/dnsmasq.8 $(DESTDIR)$(MANDIR)/man8 
                    114:        $(INSTALL) -m 755 $(BUILDDIR)/dnsmasq $(DESTDIR)$(BINDIR)
                    115: 
                    116: all-i18n : $(BUILDDIR)
                    117:        @cd $(BUILDDIR) && $(MAKE) \
                    118:  top="$(top)" \
                    119:  i18n=-DLOCALEDIR=\'\"$(LOCALEDIR)\"\' \
1.1.1.5 ! misho     120:  build_cflags="$(version) $(dbus_cflags) $(idn2_cflags) $(idn_cflags) $(ct_cflags) $(lua_cflags) $(nettle_cflags) $(nft_cflags)" \
        !           121:  build_libs="$(dbus_libs) $(idn2_libs) $(idn_libs) $(ct_libs) $(lua_libs) $(sunos_libs) $(nettle_libs) $(gmp_libs) $(ubus_libs) $(nft_libs)"  \
1.1       misho     122:  -f $(top)/Makefile dnsmasq
                    123:        for f in `cd $(PO); echo *.po`; do \
                    124:                cd $(top) && cd $(BUILDDIR) && $(MAKE) top="$(top)" -f $(top)/Makefile $${f%.po}.mo; \
                    125:        done
                    126: 
                    127: install-i18n : all-i18n install-common
                    128:        cd $(BUILDDIR); $(top)/bld/install-mo $(DESTDIR)$(LOCALEDIR) $(INSTALL)
                    129:        cd $(MAN); ../bld/install-man $(DESTDIR)$(MANDIR) $(INSTALL)
                    130: 
                    131: merge : 
1.1.1.3   misho     132:        @cd $(BUILDDIR) && $(MAKE) top="$(top)" -f $(top)/Makefile dnsmasq.pot
1.1       misho     133:        for f in `cd $(PO); echo *.po`; do \
                    134:                echo -n msgmerge $(PO)/$$f && $(MSGMERGE) --no-wrap -U $(PO)/$$f $(BUILDDIR)/dnsmasq.pot; \
                    135:        done
                    136: 
1.1.1.4   misho     137: # Canonicalise .po file.
1.1.1.2   misho     138: %.po : 
                    139:        @cd $(BUILDDIR) && $(MAKE) -f $(top)/Makefile dnsmasq.pot
                    140:        mv $(PO)/$*.po $(PO)/$*.po.orig && $(MSGMERGE) --no-wrap $(PO)/$*.po.orig $(BUILDDIR)/dnsmasq.pot >$(PO)/$*.po; 
                    141: 
1.1       misho     142: $(BUILDDIR):
                    143:        mkdir -p $(BUILDDIR)
                    144: 
1.1.1.2   misho     145: # rules below are helpers for size tracking
                    146: 
                    147: baseline : mostly_clean all
                    148:        @cd $(BUILDDIR) && \
                    149:           mv dnsmasq dnsmasq_baseline
                    150: 
                    151: bloatcheck : $(BUILDDIR)/dnsmasq_baseline mostly_clean all
                    152:        @cd $(BUILDDIR) && \
                    153:            $(top)/bld/bloat-o-meter dnsmasq_baseline dnsmasq; \
                    154:            size dnsmasq_baseline dnsmasq
1.1       misho     155: 
1.1.1.4   misho     156: # rules below are targets in recursive makes with cwd=$(BUILDDIR)
1.1       misho     157: 
1.1.1.3   misho     158: $(copts_conf): $(hdrs)
                    159:        @rm -f *.o .copts_*
1.1       misho     160:        @touch $@
                    161: 
                    162: $(objs:.o=.c) $(hdrs):
                    163:        ln -s $(top)/$(SRC)/$@ .
                    164: 
1.1.1.3   misho     165: $(objs): $(copts_conf) $(hdrs)
                    166: 
1.1       misho     167: .c.o:
                    168:        $(CC) $(CFLAGS) $(COPTS) $(i18n) $(build_cflags) $(RPM_OPT_FLAGS) -c $< 
                    169: 
1.1.1.3   misho     170: dnsmasq : $(objs)
1.1       misho     171:        $(CC) $(LDFLAGS) -o $@ $(objs) $(build_libs) $(LIBS) 
                    172: 
                    173: dnsmasq.pot : $(objs:.o=.c) $(hdrs)
                    174:        $(XGETTEXT) -d dnsmasq --foreign-user --omit-header --keyword=_ -o $@ -i $(objs:.o=.c)
                    175: 
                    176: %.mo : $(top)/$(PO)/%.po dnsmasq.pot
                    177:        $(MSGMERGE) -o - $(top)/$(PO)/$*.po dnsmasq.pot | $(MSGFMT) -o $*.mo -
                    178: 
1.1.1.2   misho     179: .PHONY : all clean mostly_clean install install-common all-i18n install-i18n merge baseline bloatcheck

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>