File: Makefile.dist

package info (click to toggle)
mol 0.9.70-17
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 6,436 kB
  • ctags: 11,008
  • sloc: ansic: 60,495; asm: 3,306; makefile: 716; yacc: 706; sh: 546; lex: 501; cpp: 370; perl: 228; pascal: 18
file content (167 lines) | stat: -rw-r--r-- 5,827 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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# -*- makefile -*-

#####################################################################

distdir		= mol-$(VERSION)
TARNAME		= mol-$(VERSION).tgz

bincheck:
	@[ ! -f mollib/drivers/video.nw ] && { \
		echo "==================================================" 	; \
		echo "  This tree does not contain the binary support"		; \
		echo "  files. Do 'make libimport' to download them." 		; \
		echo "==================================================" 	; \
		exit 1 ; \
	} ; true

dist-local: bincheck
	@$(RM) -r $(distdir)
	@echo "Populating $(distdir)"
	@for x in * ; do \
		test -d $(distdir) || mkdir $(distdir) ; \
		cp -r $$x $(distdir)/ ; \
	done
	@echo "Cleaning out certain files in $(distdir)"
	@{ while read x ; \
		do find $(distdir) -path $(distdir)/"$$x" -exec $(RM) -r {} ';' ; \
	done ; } < config/nodist >& /dev/null
	@echo "Creating $(TARNAME)"
	@tar -czf $(TARNAME) $(distdir)

dist-post: dist-local
	@$(MAKE) filecheck
	@$(RM) -r $(distdir)

distdir-clean:
	@$(RM) -r $(distdir)

clean-local: distdir-clean

dist: dist-post

filecheck:
	@rm -f /tmp/moldist.tmp1 /tmp/moldist.tmp2
	@FILTER="`{ set -f ; while read x ; do echo ! -path ./$$x ; done ; } < config/nodist`" ; \
	set -f ; find . $$FILTER ! -path "./$(distdir)*" | sort > /tmp/moldist.tmp1
	@cd $(distdir) ; find . | sort > /tmp/moldist.tmp2
	@echo "==============================================="
	@echo "  FILECHECK: [-] Missing, [+] Extra"
	@echo "==============================================="
	@diff -u /tmp/moldist.tmp1 /tmp/moldist.tmp2 | grep '^[+-]' ; true
	@echo "==============================================="
	@$(RM) /tmp/moldist.tmp*

#######################################################################################

paths: 
	@echo "bindir:              $(bindir)"
	@echo "mandir:              $(mandir)"
	@echo "etcdir:              $(etcdir)"
	@echo "docdir:              $(docdir)"
	@echo "vardir:              $(vardir)"
	@echo "libdir:              $(libdir)"
	@echo "datadir:             $(datadir)"


CONDITIONAL_BINS 	:= molvconfig
MOLBINFILES		:= startmol mol molrcget mol_uname kver_approx modload \
			  keyremap selftest
COND_MOLBINFILES	:= moldeb
SYMBINS			:= startmol mol molrcget
COND_SYMLINKS		:= moldeb

install: install-modules
	@$(INSTALL_DIR) -v $(_bindir) $(_datadir) $(_etcdir) $(_vardir)
	@$(INSTALL_DIR) -v $(_docdir) $(_libdir) $(_libdir)/bin/
	@$(INSTALL_DIR) -v $(addprefix $(_datadir)/, images nvram drivers oftrees)
	@$(INSTALL_DIR) -v $(addprefix $(_datadir)/, vmodes config syms graphics )

	@cd $(molbin) ; for x in $(CONDITIONAL_BINS) ; do \
	  test -f $$x || continue ; \
	  $(INSTALL_PROGRAM) -v $$x $(_bindir) || exit 1 ; \
	done ; true

	@cd $(molbin) ; for x in $(MOLBINFILES) ; do \
	  $(INSTALL_PROGRAM) -v $$x $(_libdir)/bin/ || exit 1 ; \
	done ; true
	@cd $(molbin) ; for x in $(COND_MOLBINFILES) ; do \
	  test -f $$x || continue ; \
	  $(INSTALL_PROGRAM) -v $$x $(_libdir)/bin/ || exit 1 ; \
	done ; true

	@for x in $(SYMBINS) ; do \
	  $(LN_S) -f $(libdir)/bin/$$x $(_bindir)/$$x || exit 1 ; \
	done ; true
	@for x in $(COND_SYMBINS) ; do \
	  test -f $$x || continue ; \
	  $(LN_S) -f $(libdir)/bin/$$x $(_bindir)/$$x || exit 1 ; \
	done ; true

	@$(INSTALL_DATA) -v $(mollib)/mol.symbols $(_libdir)/

	@$(INSTALL_DATA) CREDITS			$(_docdir)/
	@$(INSTALL_DATA) mollib/images/*.dmg 		$(_datadir)/images/
	@$(INSTALL_DATA) mollib/startboing 		$(_datadir)/startboing
	@$(INSTALL_DATA) mollib/graphics/*.raw		$(_datadir)/graphics/
	@$(INSTALL_DATA) mollib/graphics/*.png		$(_datadir)/graphics/
	@$(INSTALL_DATA) mollib/oftrees/*.cpu 		$(_datadir)/oftrees/
	@$(INSTALL_DATA) mollib/oftrees/oftree.* 	$(_datadir)/oftrees/
	@$(INSTALL_DATA) mollib/config/*.sys 		$(_datadir)/config/
	@$(INSTALL_DATA) mollib/config/*.post 		$(_datadir)/config/
	@$(INSTALL_DATA) mollib/vmodes/*.modes		$(_datadir)/vmodes/
	@$(INSTALL_DATA) mollib/syms/*.syms		$(_datadir)/syms/
	@$(INSTALL_DATA) mollib/syms/of_words		$(_datadir)/syms/
	@$(INSTALL_DATA) mollib/nvram/nvram.dist	$(_datadir)/nvram/
	@$(INSTALL_DATA) mollib/nvram/nvram.dist	$(_vardir)/nvram.nw
	@$(MAKE) -C Doc install
	chmod u+s $(_libdir)/bin/mol


install_modules: install-modules
install-modules:
	@$(INSTALL) -v -d $(_libdir)/modules
	@test -d $(mollib)/modules || mkdir $(mollib)/modules
	@MODS=`find mollib/modules -name '*.o' -o -name '*.ko'` || exit 1 ; [ "$$MODS" ] && { \
	for x in $$MODS ; do \
		y=`echo $$x | sed -e s/mollib// -e "s/[a-zA-Z0-9_]*\.k*o$$//"` 		; \
		$(INSTALL) -v -d $(_libdir)/$$y || exit 1 	 			; \
		$(INSTALL) -v --mode=644 $$x $(_libdir)/$$y || exit 1			; \
	done ; } ; true


#####################################################################

multi_modules:
	@[ "$$KERNEL_TREES" ] || { echo "KERNEL_TREES undefined!" ; false;  }
	@KERNELS=`find $$KERNEL_TREES -xtype d -maxdepth 1 -exec test -d {}/include/linux \; -print` ; \
	for x in $$KERNELS ; do \
		echo "============ Buildning modules for '$$x' ====================" ; \
		$(MAKE) -C src/kmod KERNEL_SOURCE=$$x clean || exit 1 ; \
		$(MAKE) -C src/kmod KERNEL_SOURCE=$$x all || exit 1 ; \
		$(MAKE) -C src/netdriver KERNEL_SOURCE=$$x clean || exit 1 ; \
		$(MAKE) -C src/netdriver KERNEL_SOURCE=$$x all || exit 1 ; \
	done
	echo "============ All modules built successfully ===================="

modules_:
	@$(MAKE) -C src/kmod all
	@$(MAKE) -C src/netdriver all
modules:
	@$(MAKE) all-local
	@$(MAKE) -C scripts all
	if [ "$$KERNEL_TREES" ] ; then $(MAKE) multi_modules ; else $(MAKE) modules_ ; fi

#####################################################################

mol_rpm: clean
	@$(MAKE) dist
	scripts/rpmdist mol $(VERSION) $(RELEASE)

kmods_rpm: clean
	@$(MAKE) dist
	export KERNEL_TREES=$(KERNEL_TREES) ; \
	scripts/rpmdist mol-kmods $(VERSION) $(RELEASE)

rpms: clean
	@$(MAKE) dist
	scripts/rpmdist all $(VERSION) $(RELEASE)