File: Makefile

package info (click to toggle)
nvram-wakeup 1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,052 kB
  • ctags: 242
  • sloc: ansic: 1,943; sh: 309; ruby: 190; makefile: 102
file content (134 lines) | stat: -rw-r--r-- 3,632 bytes parent folder | download | duplicates (2)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Makefile for nvram-wakeup
#
# $Id: Makefile 910 2008-11-23 13:40:45Z tiber $

# we rely on sed and msgfmt here.


# where do you want the program to be installed?
prefix   = /usr/local
BINDIR   = ${prefix}/bin
SBINDIR  = ${prefix}/sbin
MANDIR   = ${prefix}/man
DOCDIR   = ${prefix}/share/doc/nvram-wakeup
GTTXTDIR = ${prefix}/share/locale/de/LC_MESSAGES

PROG      = nvram-wakeup
PROG_SH   = VDR/vdrshutdown
HELPER    = rtc time biosinfo guess cat_nvram
HELPER_SH = guess-helper
DOC       = README README.mb README.reboot HISTORY nvram-wakeup.conf

BINS   = nvram-wakeup rtc time biosinfo guess cat_nvram
OBJS   = nvram-wakeup.o nvram-wakeup-mb.o bios.o gmt-test.o byteops.o \
         nvramops.o guess.o biosinfo.o tools.o readconf.o cat_nvram.o \
         rtc.o time.o
SRCS   = $(OBJS:%.o=%.c)
HDRS   = nvram-wakeup.h
GTTXT  = guess-helper.mo
GTTXTSRC = $(GTTXT:%.mo=%.po)
MAN5   = nvram-wakeup.conf.5
MAN8   = nvram-wakeup.8 biosinfo.8 cat_nvram.8 guess-helper.8 guess.8 \
         rtc.8 set_timer.8 time.8
MAN5GZ = $(MAN5:%.5=%.5.gz)
MAN8GZ = $(MAN8:%.8=%.8.gz)
DEVS = /dev/nvram /dev/rtc /dev/mem
CLEANFILES = $(BINS) $(OBJS) $(MAN5GZ) $(MAN8GZ) $(GTTXT) cvs_revs.h

# For the dist target:
TMPDIR = /tmp
VERSION = $(shell sed -ne '/define VERSION/s/^.*"\(.*\)".*$$/\1/p' nvram-wakeup.h)

CC = gcc
DEFS = -D_GNU_SOURCE
CFLAGS = -O2 -Wall -Wstrict-prototypes -g -pedantic $(DEFS)
INSTALL = install
INSTALL_STRIP = $(INSTALL) -s

all: $(BINS) $(GTTXT)
	size $(BINS)

nvram-wakeup:   nvram-wakeup.o nvram-wakeup-mb.o gmt-test.o byteops.o nvramops.o bios.o tools.o readconf.o 

biosinfo:	bios.o biosinfo.o tools.o

guess:          guess.o byteops.o bios.o tools.o 

cat_nvram:      cat_nvram.o tools.o nvramops.o

rtc:            rtc.o

time:           time.o

$(OBJS): $(HDRS) cvs_revs.h

cvs_revs.h: $(HDRS) $(SRCS)
	@echo Preparing $@
	@echo 'static char* CVS_ALL[] = {' >cvs_revs.h
	@grep $^ -e '[^"]$$Id' |sed "s/^.*\(\$$Id.*\$$\)/\"\1\",/">>cvs_revs.h
	@echo 'NULL };' >>cvs_revs.h
	
man: $(MAN5GZ) $(MAN8GZ)

%.gz: 
	gzip -cf9 `basename $@ .gz` >$@

%.mo: $(GTTXTSRC)
	msgfmt `basename $@ .mo`.po -o $@

devices: $(DEVS)

/dev/nvram:
	mknod $@ c 10 144

/dev/rtc:
	mknod $@ c 10 135

/dev/mem:
	mknod $@ c 1  1

clean:
	@$(RM) $(CLEANFILES)

rebuild:  clean all man

install-common:  all man
	@$(INSTALL) -vd $(BINDIR)
	@$(INSTALL) -vd $(SBINDIR)
	@$(INSTALL) -vd $(MANDIR)/man5
	@$(INSTALL) -vd $(MANDIR)/man8
	@$(INSTALL) -vd $(DOCDIR)
	@$(INSTALL) -vd $(GTTXTDIR)
	@$(INSTALL) -vm 755 $(PROG_SH)    $(BINDIR)
	@$(INSTALL) -vm 755 $(HELPER_SH)  $(SBINDIR)
	@$(INSTALL) -vm 644 $(MAN5GZ)     $(MANDIR)/man5
	@$(INSTALL) -vm 644 $(MAN8GZ)     $(MANDIR)/man8
	@$(INSTALL) -vm 644 $(DOC)        $(DOCDIR)
	@$(INSTALL) -vm 755 $(GTTXT)      $(GTTXTDIR)

install:  install-common
	@$(INSTALL) -vm 755 $(PROG)    $(BINDIR)
	@$(INSTALL) -vm 755 $(HELPER)  $(SBINDIR)

install-strip:  install-common
	@$(INSTALL_STRIP) -vm 755 $(PROG)    $(BINDIR)
	@$(INSTALL_STRIP) -vm 755 $(HELPER)  $(SBINDIR)

uninstall:
	cd $(BINDIR); rm -f $(PROG) $(subst VDR/,,$(PROG_SH))
	cd $(SBINDIR); rm -f $(HELPER) $(HELPER_SH)
	cd $(MANDIR)/man5; rm -f $(MAN5GZ)
	cd $(MANDIR)/man8; rm -f $(MAN8GZ)
	cd $(DOCDIR); rm -f $(DOC)
	cd $(GTTXTDIR); rm -f $(GTTXT)

tags: $(SRCS) $(HDRS)
	ctags $(SRCS) $(HDRS)

dist: clean
	@-rm -rf $(TMPDIR)/nvram-wakup-$(VERSION)
	@mkdir $(TMPDIR)/nvram-wakup-$(VERSION)
	@cp -a * $(TMPDIR)/nvram-wakup-$(VERSION)
	@tar czf nvram-wakup-$(VERSION).tar.gz -C $(TMPDIR) --exclude .svn nvram-wakup-$(VERSION)
	@-rm -rf $(TMPDIR)/nvram-wakup-$(VERSION)
	@echo Distribution package created as nvram-wakup-$(VERSION).tar.gz