File: Makefile

package info (click to toggle)
v4l-utils 0.8.8-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,492 kB
  • sloc: ansic: 33,068; cpp: 10,882; perl: 4,294; makefile: 470; php: 119; sh: 24
file content (45 lines) | stat: -rw-r--r-- 1,425 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
TARGETS = ir-keytable

all: $(TARGETS)

-include *.d

ir-keytable: keytable.o
	$(CC) $(LDFLAGS) -o $@ $^

keytable.o: keytable.c parse.h

sync-with-kernel:
	@if [ ! -f $(KERNEL_DIR)/include/linux/input.h ]; then \
	  echo "Error you must set KERNEL_DIR to point to an extracted kernel source dir"; \
	  exit 1; \
	fi
	@echo generating parse.h
	@printf "struct parse_key {\n\tchar *name;\n\tunsigned int value;\n} " >parse.h
	@printf "keynames[] = {\n" >>parse.h

	@more $(KERNEL_DIR)/include/linux/input.h |perl -n \
	-e 'if (m/^\#define\s+(KEY_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \
	-e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \
	-e 'if (m/^\#define\s+(BTN_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \
	-e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \
	>> parse.h
	@printf "\t{ NULL, 0}\n};\n" >>parse.h

	@-mkdir -p rc_keymaps
	@-rm rc_keymaps/*
	@echo storing existing keymaps at rc_keymaps/
	@./gen_keytables.pl $(KERNEL_DIR);

install: $(TARGETS)
	mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)/etc
	install -m 755 $(TARGETS) $(DESTDIR)$(PREFIX)/bin
	install -m 644 -p rc_maps.cfg $(DESTDIR)/etc
	install -m 755 -d $(DESTDIR)/etc/rc_keymaps
	install -m 644 -p rc_keymaps/* $(DESTDIR)/etc/rc_keymaps
	install -m 755 -d $(DESTDIR)/lib/udev/rules.d
	install -m 644 -p 70-infrared.rules $(DESTDIR)/lib/udev/rules.d
	install -m 755 -d $(DESTDIR)$(MANDIR)/man1
	install -m 644 -p ir-keytable.1 $(DESTDIR)$(MANDIR)/man1

include ../../Make.rules