File: Makefile.modules

package info (click to toggle)
mol 0.9.61-6
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 6,140 kB
  • ctags: 8,491
  • sloc: ansic: 50,560; asm: 2,826; sh: 458; makefile: 373; perl: 165; lex: 135; yacc: 131
file content (142 lines) | stat: -rw-r--r-- 4,105 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
# -*-makefile -*-
# 
#   Creation Date: <2001/04/29 19:32:37 samuel>
#   Time-stamp: <2001/08/25 22:12:50 samuel>
#   
#	<Makefile.modules>
#	
#	Targets for installing the kernel modules and building
#	RPM packages.
#   
#   Copyright (C) 2001 Samuel Rydh (samuel@ibrium.se)
#   
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License
#   as published by the Free Software Foundation
#  
#

#################################################################################
# Misc
#################################################################################

BUILD_MODULES	= YES

SUB_DIRS	+= kernel_module netdriver

MOD_RPM_NAME_M	= mol-kmods-$(VERSION)
MOD_RPM_NAME	= mol-$(UNAME)-kmods-$(VERSION)

K_SPECFILE_M 	= $(REDHAT)/SPECS/$(MOD_RPM_NAME_M).spec
K_SPECFILE 	= $(REDHAT)/SPECS/$(MOD_RPM_NAME).spec

ifdef KERNEL_TREES
MULTI_MODULES	= $(shell find $(KERNEL_TREES) -xtype d -maxdepth 1 -exec \
			test -d '{}'/include/linux \; -print)
KTREES_RPM_OPT	= --define 'kernel_trees $(KERNEL_TREES)'
else
MULTI_MODULES	= $(KERNEL_TREE)
endif

MOL_MODULES	= kernel_module/molsymglue.o kernel_module/mol.o netdriver/sheep_net.o

default:	modules

#################################################################################
# Kernel Headers Check
#################################################################################

all: _print_uname
_print_uname: dummy
	@$(MAKE) -C kernel_module print_uname


#################################################################################
# Targets
#################################################################################

modules: dummy
	$(MAKE) -C kernel_module
	$(MAKE) -C netdriver


#################################################################################
# Install targets
#################################################################################

install: install_modules
_install: install_modules

install_modules: install_modules_
	@echo
	@echo +++ MODULE INSTALL COMPLETE +++
	@echo

install_modules_: dummy modules
	@test -d mollib/modules || make modules
	@echo
	@echo +++ INSTALLING MODULES +++
	@echo
	@install -d $(MOL_MODULE_DIR)
	@for y in $(MOL_MODULES); do	\
		echo "  installing $$y into $(MOL_MODULE_DIR)"; \
		install --mode=644 $$y $(MOL_MODULE_DIR) || exit 1; \
	done


#################################################################################
# RPM targets
#################################################################################

rpm: mods_rpm

mods_rpm: clean dummy
	$(SMAKE) mod_archive TAR_NAME=mol-kmods-$(VERSION)
	$(RM) $(K_SPECFILE_M)
	echo "%define version $(VERSION)" >> $(K_SPECFILE_M)
	cat scripts/mol-kmods.spec.stub >> $(K_SPECFILE_M)
	rpm -ba $(K_SPECFILE_M) $(KTREES_RPM_OPT)


# Uggly hack to get UNAME defined properly...
vmods_rpm: clean dummy
	$(SMAKE) vmods_rpm_ KMOD_BUILD=yes

vmods_rpm_: clean dummy
	$(SMAKE) mod_archive TAR_NAME=mol-$(UNAME)-kmods-$(VERSION)
	$(RM) $(K_SPECFILE)
	echo "%define version $(VERSION)" >> $(K_SPECFILE)
	echo "%define modname mol-$(UNAME)-kmods" >> $(K_SPECFILE)
	cat scripts/mol-kmod.spec.stub >> $(K_SPECFILE)
	rpm -ba $(K_SPECFILE)


mod_archive: dummy
	@echo
	@echo '--- KERNEL MODULES ARCHIVE $(VERSION) --- $(TAR_NAME) ---'
	@echo
	@rm -rf /tmp/molbuild ; mkdir /tmp/molbuild > /dev/null ; true
	ln -s $(CURDIR) /tmp/molbuild/$(TAR_NAME)
	cd /tmp/molbuild ; $(TAR) -hzcf /tmp/$(TAR_NAME).tgz 		\
		--exclude-from /tmp/molbuild/$(TAR_NAME)/.exclude 	\
		$(addprefix $(TAR_NAME)/, $(shell cat .ktarfiles))
	@rm -rf /tmp/molbuild
	@mv -f /tmp/$(TAR_NAME).tgz $(REDHAT)/SOURCES/

#################################################################################
# Cleaning...
#################################################################################

clean:		module_clean
# Clean each subdirectory
.PHONY:	clean $(SUB_DIRS)
clean:		module_clean
module_clean:	dummy $(SUB_DIRS)
$(SUB_DIRS):
	$(MAKE) -C $@ clean

# include the Rules.make file
include Rules.make

# the following is necessary for the Rules.make file
export DEPEND_BUILT=yes