File: Makefile

package info (click to toggle)
isdnutils 1:3.25+dfsg1-3.5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 18,188 kB
  • ctags: 12,236
  • sloc: ansic: 98,041; sh: 19,044; perl: 4,948; makefile: 3,145; cpp: 2,708; tcl: 22
file content (248 lines) | stat: -rw-r--r-- 6,716 bytes parent folder | download | duplicates (3)
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# $Id: Makefile,v 1.65 2008/08/31 11:38:16 keil Exp $
#
# Toplevel Makefile for isdn4k-utils
#

.EXPORT_ALL_VARIABLES:

export I4LVERSION = 3.25

all:	do-it-all

#
# Make "config" the default target if there is no configuration file.
#

# Following line is important for lib and isdnlog (sl).
export ROOTDIR=$(shell pwd)

ifeq (.config,$(wildcard .config))
include .config
do-it-all:      subtargets
else
CONFIGURATION = config
do-it-all:      config
endif

EXTRADIRS = isdnlog/tools/zone isdnlog/tools/dest

BUILD_ONLY :=
SUBDIRS :=
ifeq ($(CONFIG_ISDNLOG),y)
	SUBDIRS := $(SUBDIRS) lib $(EXTRADIRS) isdnlog
	BUILD_ONLY := isdnlog/tools/cdb
else
	ifeq ($(CONFIG_CTRL_CONF),y)
		SUBDIRS := $(SUBDIRS) lib
	endif
endif
ifeq ($(CONFIG_ISDNCTRL),y)
	SUBDIRS := $(SUBDIRS) isdnctrl
endif
ifeq ($(CONFIG_DIVERTCTRL),y)
	SUBDIRS := $(SUBDIRS) divertctrl
endif
ifeq ($(CONFIG_IPROFD),y)
	SUBDIRS := $(SUBDIRS) iprofd
endif
ifeq ($(CONFIG_ICNCTRL),y)
	SUBDIRS := $(SUBDIRS) icn
endif
ifeq ($(CONFIG_HISAXCTRL),y)
	SUBDIRS := $(SUBDIRS) hisax
endif

ifeq ($(CONFIG_RCAPID),y)
	SUBDIRS := $(SUBDIRS) capiinfo
else
	ifeq ($(CONFIG_AVMCAPICTRL),y)
		SUBDIRS := $(SUBDIRS) capiinfo
	endif
endif

ifeq ($(CONFIG_AVMCAPICTRL),y)
	SUBDIRS := $(SUBDIRS) avmb1 capiinit
endif
ifeq ($(CONFIG_ACTCTRL),y)
	SUBDIRS := $(SUBDIRS) act2000
endif
ifeq ($(CONFIG_LOOPCTRL),y)
	SUBDIRS := $(SUBDIRS) loop
endif
ifeq ($(CONFIG_EICONCTRL),y)
	SUBDIRS := $(SUBDIRS) eicon
endif
ifeq ($(CONFIG_IMON),y)
	SUBDIRS := $(SUBDIRS) imon
endif
ifeq ($(CONFIG_IMONTTY),y)
	SUBDIRS := $(SUBDIRS) imontty
endif
ifeq ($(CONFIG_IPPPSTATS),y)
	SUBDIRS := $(SUBDIRS) ipppstats
endif
ifeq ($(CONFIG_XMONISDN),y)
	SUBDIRS := $(SUBDIRS) xmonisdn
endif
ifeq ($(CONFIG_XISDNLOAD),y)
	SUBDIRS := $(SUBDIRS) xisdnload
endif
ifeq ($(CONFIG_IPPPD),y)
	SUBDIRS := $(SUBDIRS) ipppd
endif
ifeq ($(CONFIG_VBOX),y)
	SUBDIRS := $(SUBDIRS) vbox
endif
ifeq ($(CONFIG_RCAPID),y)
	SUBDIRS := $(SUBDIRS) rcapid
endif
ifeq ($(CONFIG_CAPIFAX),y)
	SUBDIRS := $(SUBDIRS) capifax
endif
ifeq ($(CONFIG_PPPDCAPIPLUGIN),y)
	SUBDIRS := $(SUBDIRS) pppdcapiplugin
endif
ifeq ($(CONFIG_GENMAN),y)
	SUBDIRS := $(SUBDIRS) doc
endif
ifeq ($(CONFIG_FAQ),y)
	SUBDIRS := $(SUBDIRS) FAQ
endif
ifeq ($(CONFIG_EUROFILE),y)
	SUBDIRS := $(SUBDIRS) eurofile
endif
ifneq ($(SUBDIRS),)
	ifeq ($(filter lib,$(SUBDIRS)),)
		SUBDIRS := lib $(SUBDIRS)
	endif
endif

subtargets: $(CONFIGURATION)
	set -e; for i in `echo $(BUILD_ONLY) $(SUBDIRS)`; do $(MAKE) -C $$i all; done

rootperm:
	@echo 'main(int argc,char**argv){unlink(argv[0]);return(getuid()==0);}'>g
	@if gcc -x c -o G g && rm -f g && ./G ; then \
		/bin/echo -e "\n\n      Need root permission for (de)installation!\n\n"; \
		exit 1; \
	fi

install:
	set -e; for i in `echo $(SUBDIRS)`; do $(MAKE) -C $$i install; done
	@: || if [ -c $(DESTDIR)/dev/isdnctrl0 ] && ls -l $(DESTDIR)/dev/isdnctrl0 | egrep "[[:space:]]45,[[:space:]]+64[[:space:]]" > /dev/null; \
	then \
		/bin/echo -e '(some) ISDN devices already exist, not creating them.\nUse scripts/makedev.sh manually if necessary.'; \
	else \
		sh scripts/makedev.sh $(DESTDIR) ; \
	fi

uninstall: rootperm
	set -e; for i in `echo $(SUBDIRS)`; do $(MAKE) -C $$i uninstall; done

#
# targets clean and distclean go through ALL directories
# regardless of configured options.
#
clean:
	-set -e; \
	for i in `echo ${wildcard */GNUmakefile}`; do \
		$(MAKE) -i -C `dirname $$i` clean; \
	done;
	-set -e; \
	for i in `echo ${wildcard */Makefile}`; do \
		$(MAKE) -i -C `dirname $$i` clean; \
	done;
	for i in `echo $(BUILD_ONLY) $(EXTRADIRS)`; do \
		if [ -f $$i/Makefile ]; then $(MAKE) -i -C $$i clean; fi; \
	done;
	-rm -f *~ *.o

distclean: clean
	-$(MAKE) -C scripts/lxdialog clean
	-set -e; \
	for i in `echo ${wildcard */GNUmakefile}`; do \
		$(MAKE) -i -C `dirname $$i` distclean; \
	done;
	-set -e; \
	for i in `echo ${wildcard */Makefile}`; do \
		if [ -f $$i ] ; then \
			$(MAKE) -i -C `dirname $$i` distclean; \
		fi ; \
	done;
	for i in `echo $(BUILD_ONLY) $(EXTRADIRS)`; do \
		if [ -f $$i/Makefile ]; then $(MAKE) -i -C $$i distclean; fi; \
	done;
	-rm -f *~ .config .config.old scripts/autoconf.h .menuconfig \
		Makefile.tmp .menuconfig.log scripts/defconfig.old
	find . -name '.#*' -exec rm -f {} \;

scripts/lxdialog/lxdialog:
	@$(MAKE) -C scripts/lxdialog all

scripts/autoconf.h: .config
	perl scripts/mk_autoconf.pl

cfgerror:
	@echo ""
	@echo "WARNING! Configure in $(ERRDIR) failed, disabling package"
	@echo ""
	@sleep 1
	@cp etc/Makefile.disabled $(ERRDIR)/Makefile

# Next target makes three attempts to configure:
#  - if a configure script exists, execute it
#  - if a Makefile.in exists, make -f Makefile.in config
#  - if a Makefile already exists, make config
#
subconfig: scripts/autoconf.h
	@echo Selected subdirs: $(BUILD_ONLY) $(SUBDIRS)
	@set -e; for i in `echo $(BUILD_ONLY) $(SUBDIRS)`; do \
		if [ $$i = eicon ] ; then \
			/bin/echo -e "\nRunning configure in $$i ...\n"; sleep 1; \
			(cd $$i; ./configure --with-sbin=$(CONFIG_SBINDIR) --bindir=$(CONFIG_BINDIR) --with-man=$(CONFIG_MANDIR) --datadir=$(CONFIG_DATADIR) --libdir=$(CONFIG_LIBDIR) --with-firmware=$(CONFIG_DATADIR) || $(MAKE) -C ../ ERRDIR=$$i cfgerror); \
		elif [ -x $$i/configure ] ; then \
			/bin/echo -e "\nRunning configure in $$i ...\n"; sleep 1; \
			(cd $$i; ./configure --sbindir=$(CONFIG_SBINDIR) --bindir=$(CONFIG_BINDIR) --mandir=$(CONFIG_MANDIR) --datadir=$(CONFIG_DATADIR) --libdir=$(CONFIG_LIBDIR) || $(MAKE) -C ../ ERRDIR=$$i cfgerror); \
		elif [ -f $$i/Makefile.in ] ; then \
			/bin/echo -e "\nRunning make -f Makefile.in config in $$i ...\n"; sleep 1; \
			$(MAKE) -C $$i -f Makefile.in config; \
		elif [ -f $$i/Makefile ] ; then \
			/bin/echo -e "\nRunning make config in $$i ...\n"; sleep 1; \
			$(MAKE) -C $$i config; \
		fi; \
	done

#
# Next target uses a second tempory Makefile
# because new .config has to be re-included.
#
menuconfig: scripts/lxdialog/lxdialog
	@scripts/Menuconfig scripts/config.in
	@cp Makefile Makefile.tmp
	$(MAKE) -f Makefile.tmp subconfig
	@rm -f Makefile.tmp

#
# For testing: runs Menuconfig only
#
testconfig: scripts/lxdialog/lxdialog
	@scripts/Menuconfig scripts/config.in

config: menuconfig

mrproper: distclean

archive: distclean
	@(ln -nvfs $(ROOTDIR) ../isdn4k-utils-$(I4LVERSION) ;\
	mkdir -p ../distisdn ;\
	tar cvhzf ../distisdn/isdn4k-utils-$(I4LVERSION).tar.gz --exclude-vcs ../isdn4k-utils-$(I4LVERSION) ;\
	rm ../isdn4k-utils-$(I4LVERSION) )

distarch: distclean
	(ln -nvfs $(ROOTDIR) ../isdn4k-utils-$(I4LVERSION) ;\
	mkdir -p ../distisdn ;\
	tar -cvhz -X distexclude -f ../distisdn/isdn4k-utils-$(I4LVERSION).tar.gz \
	--exclude-vcs ../isdn4k-utils-$(I4LVERSION) ;\
	rm ../isdn4k-utils-$(I4LVERSION) )

dist: distarch