File: Makefile

package info (click to toggle)
ndiswrapper 1.28-1%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 956 kB
  • ctags: 5,764
  • sloc: ansic: 21,342; perl: 743; makefile: 384; asm: 159; sh: 134
file content (88 lines) | stat: -rw-r--r-- 2,652 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
DRIVER_VERSION = $(shell sed -n 's/^\#define[ \t]\+DRIVER_VERSION[ \t]\+"\([^"]\+\)"/\1/p' driver/ndiswrapper.h)

UTILS_VERSION = $(shell sed -n 's/^\#define[ \t]\+UTILS_VERSION[ \t]\+"\([^"]\+\)"/\1/p' driver/ndiswrapper.h)

distdir=ndiswrapper-${DRIVER_VERSION}
distarchive=${distdir}.tar.gz

DISTFILES=AUTHORS ChangeLog INSTALL Makefile README ndiswrapper.spec \
				   ndiswrapper.8 loadndisdriver.8
DIST_SUBDIRS=utils driver

DESTDIR = 
mandir = $(DESTDIR)$(shell [ -d /usr/man/man8 ] && echo /usr/man || echo /usr/share/man )

KVERS ?= $(shell uname -r)

.PHONY: all

all: 
	+make -C driver
	+make -C utils

.PHONY: install
install:
	+make -C driver install
	+make -C utils install
	mkdir -p -m 0755 $(mandir)/man8
	install -m 644 ndiswrapper.8 $(mandir)/man8
	install -m 644 loadndisdriver.8 $(mandir)/man8

.PHONY: clean distclean
clean:
	+make -C driver clean
	+make -C utils clean
	rm -f *~
	rm -fr ${distdir} ${distdir}.tar.gz patch-stamp

distclean: clean
	+make -C driver distclean
	+make -C utils distclean
	rm -f .\#*

uninstall:
	@echo "NOTE: Not all installed files are removed, as different" \
		"distributions install ndiswrapper files at different places."
	@echo "Run uninstall as many times as necessary until no" \
		"\"removing\" messages appear below."
	@if [ "x$(shell which loadndisdriver)" != "x" ]; then \
		echo "removing $(shell which loadndisdriver)"; \
		/bin/rm -f $(shell which loadndisdriver); \
	fi
	@if [ "x$(shell which ndiswrapper)" != "x" ]; then \
		echo "removing $(shell which ndiswrapper)"; \
		/bin/rm -f $(shell which ndiswrapper); \
	fi
	@if [ "x$(shell which ndiswrapper-buginfo)" != "x" ]; then \
		echo "removing $(shell which ndiswrapper-buginfo)"; \
		/bin/rm -f $(shell which ndiswrapper-buginfo); \
	fi
	@for module in $(shell find /lib/modules/$(KVERS) \
			-name "ndiswrapper*"); do \
		echo "removing $$module"; \
		/bin/rm -f $$module; \
	done

dist:
	@rm -rf ${distdir}
	mkdir -p ${distdir}
	@for file in $(DISTFILES); do \
	  cp  $$file $(distdir)/$$file; \
	done
	for subdir in $(DIST_SUBDIRS); do \
	  if test "$$subdir" = .; then :; else \
	    test -d $(distdir)/$$subdir \
	    || mkdir $(distdir)/$$subdir \
	    || exit 1; \
	  fi; \
	done
	+make -C driver distdir=../${distdir}/driver dist
	+make -C utils distdir=../${distdir}/utils dist

	# Update version in dist rpm spec file - don't crash if it fails
	-sed -i "s/\%define\s\+ndiswrapper_version\s\+[^\}]\+\}/%define ndiswrapper_version $(DRIVER_VERSION)\}/" $(distdir)/ndiswrapper.spec
	tar cfz ${distarchive} ${distdir}

rpm: dist ndiswrapper.spec
	rpmbuild -ta $(distarchive) --define="ndiswrapper_version $(DRIVER_VERSION)"