1 # Modify as you see fit, note this is built into crda,
2 # so if you change it here you will have to change crda.c
3 REG_BIN?=/usr/lib/crda/regulatory.bin
4 REG_GIT?=git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git
7 MANDIR ?= $(PREFIX)/share/man/
11 # Use a custom CRDA_UDEV_LEVEL when callling make install to
12 # change your desired level for the udev regulatory.rules
14 UDEV_LEVEL=$(CRDA_UDEV_LEVEL)-
15 # You can customize this if your distributions uses
16 # a different location.
17 UDEV_RULE_DIR?=/lib/udev/rules.d/
19 # If your distribution requires a custom pubkeys dir
20 # you must update this variable to reflect where the
21 # keys are put when building. For example you can run
22 # with make PUBKEY_DIR=/usr/lib/crda/pubkeys
27 all: $(REG_BIN) crda intersect verify
29 ifeq ($(USE_OPENSSL),1)
30 CFLAGS += -DUSE_OPENSSL `pkg-config --cflags openssl`
31 LDLIBS += `pkg-config --libs openssl`
36 CFLAGS += -DUSE_GCRYPT
39 reglib.o: keys-gcrypt.c
45 NL1FOUND := $(shell pkg-config --atleast-version=1 libnl-1 && echo Y)
46 NL2FOUND := $(shell pkg-config --atleast-version=2 libnl-2.0 && echo Y)
53 CFLAGS += -DCONFIG_LIBNL20
59 $(error Cannot find development files for any supported version of libnl)
62 NLLIBS += `pkg-config --libs $(NLLIBNAME)`
63 CFLAGS += `pkg-config --cflags $(NLLIBNAME)`
74 $(NQ) ' EXIST ' $(REG_BIN)
76 $(NQ) ERROR: The file: $(REG_BIN) is missing. You need this in place in order
77 $(NQ) to build CRDA. You can get it from:
81 $(NQ) "Once cloned (no need to build) cp regulatory.bin to $(REG_BIN)"
85 keys-%.c: utils/key2pub.py $(wildcard $(PUBKEY_DIR)/*.pem)
87 $(NQ) ' Trusted pubkeys:' $(wildcard $(PUBKEY_DIR)/*.pem)
88 $(Q)./utils/key2pub.py --$* $(wildcard $(PUBKEY_DIR)/*.pem) $@
92 $(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
96 $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(NLLIBS)
98 regdbdump: reglib.o regdbdump.o print-regdom.o
100 $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
102 intersect: reglib.o intersect.o print-regdom.o
104 $(Q)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
106 verify: $(REG_BIN) regdbdump
107 $(NQ) ' CHK $(REG_BIN)'
108 $(Q)./regdbdump $(REG_BIN) >/dev/null
114 install: crda crda.8.gz regdbdump.8.gz
115 $(NQ) ' INSTALL crda'
116 $(Q)$(MKDIR) $(DESTDIR)/$(SBINDIR)
117 $(Q)$(INSTALL) -m 755 -t $(DESTDIR)/$(SBINDIR) crda
118 $(NQ) ' INSTALL regdbdump'
119 $(Q)$(INSTALL) -m 755 -t $(DESTDIR)/$(SBINDIR) regdbdump
120 $(NQ) ' INSTALL $(UDEV_LEVEL)regulatory.rules'
121 $(Q)$(MKDIR) $(DESTDIR)/$(UDEV_RULE_DIR)/
122 @# This removes the old rule you may have, we were not
123 @# putting it in the right place.
124 $(Q)rm -f $(DESTDIR)/etc/udev/rules.d/regulatory.rules
125 $(Q)sed 's:$$(SBINDIR):$(SBINDIR):' udev/regulatory.rules > udev/regulatory.rules.parsed
126 $(Q)ln -sf regulatory.rules.parsed udev/$(UDEV_LEVEL)regulatory.rules
127 $(Q)$(INSTALL) -m 644 -t \
128 $(DESTDIR)/$(UDEV_RULE_DIR)/ \
129 udev/$(UDEV_LEVEL)regulatory.rules
130 $(NQ) ' INSTALL crda.8.gz'
131 $(Q)$(MKDIR) $(DESTDIR)$(MANDIR)/man8/
132 $(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ crda.8.gz
133 $(NQ) ' INSTALL regdbdump.8.gz'
134 $(Q)$(INSTALL) -m 644 -t $(DESTDIR)/$(MANDIR)/man8/ regdbdump.8.gz
137 $(Q)rm -f crda regdbdump intersect *.o *~ *.pyc keys-*.c *.gz \
138 udev/$(UDEV_LEVEL)regulatory.rules udev/regulatory.rules.parsed