1#
2# Broadcom Linux Router Makefile
3#
4# Copyright 2016, Broadcom
5# All Rights Reserved.
6#
7# THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8# KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9# SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10# FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11#
12#
13
14include common.mak
15include $(SRCBASE)/.config
16
17ifeq ($(RTCONFIG_RALINK),y)
18else ifeq ($(RTCONFIG_QCA),y)
19export CFLAGS += $(EXTRACFLAGS)
20else
21# Broadcom
22export CFLAGS += -DBCMWPA2
23ifeq ($(RTCONFIG_BCMWL6),y)
24export CFLAGS += -DBCMQOS
25export CFLAGS += -DBCM_DCS
26export CFLAGS += -DEXT_ACS
27export CFLAGS += -DD11AC_IOTYPES
28export CFLAGS += -DPHYMON
29export CFLAGS += -DPROXYARP
30export CFLAGS += -DTRAFFIC_MGMT
31export CFLAGS += -DTRAFFIC_MGMT_RSSI_POLICY
32ifeq ($(RTCONFIG_BCMARM),y)
33export CONFIG_MFP=y
34export CFLAGS += -DMFP
35export CFLAGS += -D__CONFIG_MFP__
36endif
37endif
38export CFLAGS += $(EXTRACFLAGS)
39endif
40
41
42ifneq ($(findstring 4G-,$(BUILD_NAME)),)
43MODEL = RT$(subst -,,$(BUILD_NAME))
44else ifneq ($(findstring DSL,$(BUILD_NAME)),)
45MODEL = $(subst -,_,$(BUILD_NAME))
46else
47MODEL = $(subst -,,$(subst +,P,$(BUILD_NAME)))
48endif
49export CFLAGS += -D$(MODEL)
50export $(MODEL)=y
51
52export OLD_SRC=$(SRCBASE)/../src
53ifeq ($(RTCONFIG_BCMARM),y)
54#export CFLAGS += -I$(SRCBASE)/common/include
55
56LINUX_VERSION=2_6_36
57LINUX_KERNEL=2.6.36
58export PLATFORM LIBDIR USRLIBDIR LINUX_VERSION
59
60ifeq ($(RTCONFIG_BCM7),y)
61export BCMSRC=src-rt-7.x.main/src
62export OLD_SRC=$(SRCBASE)/../../src
63export  BUILD_MFG := 0
64export  EX7 := _7
65else ifeq ($(RTCONFIG_BCM_794),y)
66export BCMSRC=src-rt-7.14.94.x/src
67export OLD_SRC=$(SRCBASE)/../../src
68export  BUILD_MFG := 0
69export  EX7 := _794
70else ifeq ($(RTCONFIG_BCM_7114),y)
71export BCMSRC=src-rt-7.14.114.x/src
72export OLD_SRC=$(SRCBASE)/../../src
73export  BUILD_MFG := 0
74export  EX7 := _7114
75else ifeq ($(RTCONFIG_BCM10),y)
76export BCMSRC=src-rt-10.10.22.x/src
77export OLD_SRC=$(SRCBASE)/../../src
78export  BUILD_MFG := 0
79export  EX7 := _10
80else ifeq ($(RTCONFIG_BCM9),y)
81export BCMSRC=src-rt-9.x/src
82export OLD_SRC=$(SRCBASE)/../../src
83export  BUILD_MFG := 0
84export  EX7 := _9
85else
86WLAN_ComponentsInUse := bcmwifi clm ppr olpc
87export BCMSRC=src-rt-6.x.4708
88endif
89include $(SRCBASE)/makefiles/WLAN_Common.mk
90export BASEDIR := $(WLAN_TreeBaseA)
91export LINUXDIR := $(SRCBASE)/linux/linux-2.6.36
92
93export EXTRALDFLAGS = -lgcc_s
94export EXTRALDFLAGS2 = -L$(TOP)/nvram$(BCMEX) -lnvram -L$(TOP)/shared -lshared
95
96
97export LD_LIBRARY_PATH := $(SRCBASE)/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/lib
98ifeq (2_6_36,$(LINUX_VERSION))
99export  BUILD_MFG := 0
100endif
101SUBMAKE_SETTINGS = SRCBASE=$(SRCBASE) BASEDIR=$(BASEDIR)
102SUBMAKE_SETTINGS += ARCH=$(ARCH)
103export CFLAGS += -O2
104export OPTCFLAGS = -O2
105WLCFGDIR=$(SRCBASE)/wl/config
106
107ROOT_IMG := target.squashfs
108CRAMFSDIR := cramfs
109
110export MKSYM := $(shell which $(TOP)/misc/mksym.pl)
111endif
112
113ifeq ($(or $(RTCONFIG_BCMWL6),$(RTAC53U)),y)
114
115WLAN_ComponentsInUse := bcmwifi clm ppr
116
117ifeq ($(or $(RTCONFIG_BCMWL6A),$(RTAC53U)),y)
118WLAN_ComponentsInUse += olpc
119endif
120ifeq ($(RTCONFIG_BCM10),y)
121WLAN_ComponentsInUse += keymgmt iocv dump phymods/cmn phymods/n phymods/lcn phymods/ac phymods/lcn40 phymods/ht
122endif
123
124
125include ../../$(SRCBASE)/makefiles/WLAN_Common.mk
126endif
127
128ifneq ($(RTCONFIG_BCMARM),y)
129KDIR=$(TOP)/kernel_header
130KERNEL_HEADER_DIR=$(TOP)/kernel_header/include
131else
132KDIR=$(LINUXDIR)
133KERNEL_HEADER_DIR=$(LINUXDIR)/include
134endif
135
136export KDIR KERNEL_HEADER_DIR
137ifeq ($(RTCONFIG_DHDAP),y)
138export CONFIG_DHDAP=y
139export CFLAGS += -D__CONFIG_DHDAP__
140ifeq ($(RTCONFIG_BCM_7114),y)
141export SRCBASE_DHD := $(SRCBASE)/../dhd/src
142export SRCBASE_SYS := $(SRCBASE_DHD)
143include Makefile.fw
144else	# 7114
145export DHDAP_USE_SEPARATE_CHECKOUTS := 1
146export SRCBASE_DHD := $(SRCBASE)/../../dhd/src
147export SRCBASE_FW  := $(SRCBASE)/../../43602/src
148PCIEFD_TARGETS_LIST	:= 43602a1-roml
149ifeq ($(WLTEST),1)
150PCIEFD_TARGET_NAME	:= pcie-ag-splitrx-fdap-mbss-mfgtest-seqcmds-phydbg-txbf-pktctx-amsdutx-ampduretry-chkd2hdma
151else
152PCIEFD_TARGET_NAME	:= pcie-ag-splitrx-fdap-mbss-mfp-wl11k-wl11u-txbf-pktctx-amsdutx-ampduretry-chkd2hdma-proptxstatus
153endif
154
155PCIEFD_EMBED_HEADER_TEMPLATE := $(SRCBASE_DHD)/shared/rtecdc_router.h.in
156PCIEFD_EMBED_HEADER	:= $(SRCBASE_DHD)/shared/rtecdc_router.h
157obj-pciefd		:= $(patsubst %,%-obj,$(PCIEFD_TARGETS_LIST))
158install-pciefd		:= $(patsubst %,%-install,$(PCIEFD_TARGETS_LIST))
159endif	#  7114
160endif
161
162ifeq ($(RTCONFIG_WLEXE),y)
163ifeq ($(RTCONFIG_BCM9),y)
164export SRCBASE_SYS := $(SRCBASE)/../sys/src
165export CONFIG_WLEXE
166export RWL ?= 0
167endif
168endif
169
170ifeq ($(RTCONFIG_GMAC3),y)
171export CFLAGS += -D__CONFIG_GMAC3__
172endif
173
174ifeq ($(RTCONFIG_TOAD),y)
175export CFLAGS += -D__CONFIG_TOAD__
176endif
177
178ifeq ($(RTCONFIG_BCMBSD),y)
179export CFLAGS += -DBCM_BSD
180endif
181ifeq ($(RTCONFIG_BCMSSD),y)
182export CFLAGS += -DBCM_SSD
183endif
184
185ifeq ($(RTCONFIG_WLCLMLOAD),y)
186export CFLAGS += -DWLCLMLOAD
187export WLCLMLOAD := 1
188endif
189
190ifeq ($(RTCONFIG_BCMASPMD),y)
191export CFLAGS += -DBCM_ASPMD
192endif
193
194ifeq ($(RTCONFIG_BCMEVENTD),y)
195export CFLAGS += -DBCM_EVENTD
196endif
197
198ifeq ($(RTCONFIG_BCMDCS),y)
199export CFLAGS += -DBCM_DCS
200endif
201
202ifeq ($(RTCONFIG_TRAFFIC_MGMT_RSSI_POLICY),y)
203export CFLAGS += -DTRAFFIC_MGMT_RSSI_POLICY
204endif
205
206ifeq ($(RTCONFIG_EMF),y)
207export CFLAGS += -D__CONFIG_EMF__
208export CONFIG_EMF_ENABLED := $(RTCONFIG_EMF)
209endif
210
211ifeq ($(RTCONFIG_HSPOT),y)
212export CONFIG_HSPOT=y
213#export CFLAGS += -D__CONFIG_HSPOT__
214export CFLAGS += -DNAS_GTK_PER_STA
215ifeq ($(or $(RTCONFIG_BCM7),$(RTCONFIG_BCM_7114)),y)
216export CFLAGS += -DHSPOT_OSEN
217endif
218endif
219
220ifeq ($(RTCONFIG_WPS),y)
221ifeq ($(CONFIG_BCMWL5),y)
222endif
223export CFLAGS += -D__CONFIG_WPS__
224# WFA WPS 2.0 Testbed extra caps
225#export CFLAGS += -DWFA_WPS_20_TESTBED
226endif
227
228ifeq ($(RTCONFIG_NORTON),y)
229export CFLAGS += -D__CONFIG_NORTON__
230endif
231
232ifeq ($(RTCONFIG_DEBUG),y)
233export CFLAGS += -g
234endif
235
236ifneq (,$(filter y,$(RTCONFIG_SFP) $(RTCONFIG_4M_SFP)))
237export  MUVER := _1.4
238endif
239
240#
241#
242#
243SEP=echo "\033[41;1m   $@   \033[0m"
244
245#
246# standard packages
247#
248obj-$(RTCONFIG_NOTIFICATION_CENTER) += sqlite
249obj-$(RTCONFIG_NOTIFICATION_CENTER) += nt_center
250obj-$(RTCONFIG_QTN) += libqcsapi_client
251obj-$(RTCONFIG_QTN) += qtnimage
252obj-$(RTCONFIG_DMALLOC) += dmalloc
253
254obj-$(RTCONFIG_DHDAP) += dhd $(if $(RTCONFIG_BCM7),pciefd)
255obj-$(RTCONFIG_BCM_7114) += dhd_monitor
256obj-y += busybox
257obj-y += shared
258obj-y += nvram$(BCMEX)
259obj-$(RTCONFIG_BCMARM) += ctf_arm
260obj-$(RTAC53U) += ctf_5358
261ifneq ($(RTCONFIG_RALINK)$(RTCONFIG_QCA),y)
262obj-y += ctf
263endif
264ifeq ($(RTCONFIG_BCMARM),y)
265ifeq ($(RTCONFIG_CFEZ),y)
266obj-y += envram_bin
267endif
268endif
269obj-$(RTCONFIG_DPSTA) += dpsta
270
271ifeq ($(RTCONFIG_RALINK),y)
272#################################################################################
273# Ralink/MTK-specific packages
274#################################################################################
275obj-y += wireless_tools
276
277ifeq ($(or $(RTN14U),$(RTAC52U),$(RTAC51U),$(RTN11P),$(RTN300),$(RTN54U),$(RTAC1200HP),$(RTN56UB1),$(RTN56UB2),$(RTAC54U)),y)
278obj-y += reg
279endif
280
281ifneq ($(findstring linux-3.x,$(LINUXDIR)),)
282# RT-N65U only
283obj-y += rt2880_app
284else	#!ifneq ($(findstring linux-3.x,$(LINUXDIR)),)
285obj-y += ated
286obj-y += flash
287ifeq ($(or $(RTN14U),$(RTAC52U),$(RTAC51U),$(RTN11P),$(RTN300),$(RTN54U),$(RTAC1200HP),$(RTN56UB1),$(RTN56UB2),$(RTAC54U)),y)
288else
289obj-y += hw_nat
290endif
291endif	#ifneq ($(findstring linux-3.x,$(LINUXDIR)),)
292
293else ifeq ($(RTCONFIG_QCA),y)
294#################################################################################
295# QCA-specific packages
296#################################################################################
297obj-y += wireless_tools
298obj-y += libnl-tiny-0.1
299obj-y += swconfig
300obj-y += qca-wifi
301#obj-y += qca-art2
302obj-y += qca-hostap
303obj-y += shortcut-fe
304
305ifeq ($(PLC_UTILS),y)
306obj-y += plc-utils
307endif
308
309ifeq ($(ART2),y)
310obj-y += LinuxART2
311endif
312
313else
314#################################################################################
315# Broadcom-specific packages
316#################################################################################
317ifneq ($(RTCONFIG_BCMARM),y)
318obj-y += lzma-loader
319endif
320
321endif	# RTCONFIG_RALINK
322
323ifeq ($(RTCONFIG_DSL),y)
324obj-y += dsl_drv_tool
325endif
326
327ifneq ($(or $(findstring linux-2.6.36,$(LINUXDIR)),$(findstring linux-3.x,$(LINUXDIR)),$(findstring linux-3.3.x,$(LINUXDIR))),)
328IPTABLES := iptables-1.4.x
329IPTC_LIBDIR := $(TOP)/$(IPTABLES)/libiptc/.libs
330IPTC_LIBS := -lip4tc $(if $(RTCONFIG_IPV6),-lip6tc,) -liptc
331obj-y += iptables-1.4.x
332obj-y += iproute2-3.x
333else
334IPTABLES := iptables
335IPTC_LIBDIR := $(TOP)/$(IPTABLES)
336IPTC_LIBS := -liptc
337obj-y += iptables
338obj-y += iproute2
339endif
340
341obj-$(RTCONFIG_BWDPI) += sqlite
342obj-$(RTCONFIG_BWDPI) += bwdpi
343obj-$(RTCONFIG_BWDPI) += bwdpi_sqlite
344obj-$(RTCONFIG_BWDPI) += bwdpi_bin
345obj-$(RTCONFIG_SPEEDTEST) += curl-7.21.7
346
347obj-$(RTCONFIG_TRAFFIC_LIMITER) += sqlite
348obj-$(RTCONFIG_TRAFFIC_LIMITER) += traffic_limiter
349
350obj-y += rc
351obj-y += rom
352obj-y += others
353obj-y += httpd json-c
354obj-y += www
355obj-y += bridge
356obj-y += dnsmasq
357obj-y += etc
358# obj-y += vlan # use Busybox vconfig
359#obj-y += utils
360obj-y += ntpclient
361
362ifneq ($(RTCONFIG_4M_SFP),y)
363obj-y += rstats
364endif
365ifeq ($(RTCONFIG_DSL),y)
366obj-y += spectrum
367endif
368ifeq ($(RTCONFIG_RALINK),y)
369obj-y += 802.1x
370obj-y += libupnp-1.3.1
371obj-y += wsc_upnp
372endif
373
374# !!TB - updated Broadcom Wireless driver
375ifeq ($(RTCONFIG_RALINK),y)
376else ifeq ($(RTCONFIG_QCA),y)
377else
378#obj-y += et
379obj-y += utils$(BCMEX)$(EX7)
380obj-$(RTCONFIG_EMF) += emf$(BCMEX)$(EX7)
381obj-$(RTCONFIG_EMF) += igs$(BCMEX)$(EX7)
382ifneq ($(RTCONFIG_BCM_794),y)	# do not build wl/dhd since not ready
383obj-y += wlconf$(BCMEX)$(EX7)
384obj-y += nas$(BCMEX)$(EX7)
385obj-$(RTCONFIG_HSPOT) += hspot_ap$(BCMEX)$(EX7)
386obj-y += eapd$(BCMEX)$(EX7)/linux
387obj-$(RTCONFIG_WPS) += wps$(BCMEX)$(EX7)
388obj-$(RTCONFIG_WLEXE) += wlexe
389endif
390obj-$(CONFIG_LIBBCM) += libbcm
391obj-$(CONFIG_LIBUPNP) += libupnp$(BCMEX)$(EX7)
392endif
393
394obj-$(RTCONFIG_BCMEVENTD) += eventd
395obj-$(RTCONFIG_BCMASPMD) += aspmd
396
397obj-$(RTCONFIG_WLCLMLOAD) += clm
398
399obj-y += libbcmcrypto
400#obj-y += cyassl
401obj-$(RTCONFIG_HTTPS) += mssl
402#obj-y += mdu
403obj-$(RTCONFIG_TFTP) += tftp
404
405# !!TB
406ifeq ($(RTCONFIG_USB),y)
407#obj-y += p910nd
408obj-y += scsi-idle
409obj-y += libusb10
410obj-y += libusb
411obj-y += libusb-0.1.12
412ifeq ($(RTCONFIG_USB),y)
413ifneq ($(RTCONFIG_8M_SFP),y)
414obj-y += hub-ctrl
415endif
416endif
417obj-$(RTCONFIG_USB_PRINTER) += u2ec
418obj-$(RTCONFIG_USB_PRINTER) += LPRng
419
420ifeq ($(RTCONFIG_INTERNAL_GOBI),y)
421obj-$(RTCONFIG_INTERNAL_GOBI) += usb-gobi
422else
423obj-$(RTCONFIG_USB_MODEM) += sdparm-1.02
424obj-$(RTCONFIG_USB_MODEM) += comgt-0.32
425obj-$(RTCONFIG_USB_MODEM) += $(if $(RTCONFIG_QCA),,uqmi)
426endif
427
428ifneq ($(or $(findstring linux-2.6.36.x,$(LINUXDIR)),$(findstring linux-2.6.36,$(LINUXDIR)),$(findstring linux-3.x,$(LINUXDIR)),$(findstring linux-3.3.x,$(LINUXDIR))),)
429ifeq ($(or $(RTN65U),$(RTAC55U),$(RTAC55UHP),$(RTN56UB1),$(RTN56UB2)),y)
430obj-$(RTCONFIG_USB_MODEM) += usbmodeswitch-1.2.3
431else
432ifneq ($(RTCONFIG_INTERNAL_GOBI),y)
433obj-$(RTCONFIG_USB_MODEM) += usb-modeswitch-2.2.3
434endif
435endif
436else
437ifeq ($(RTCONFIG_BCMWL6),y)
438obj-$(RTCONFIG_USB_MODEM) += usb-modeswitch-2.2.3
439else
440obj-$(RTCONFIG_USB_MODEM) += usbmodeswitch
441endif
442endif
443
444obj-$(RTCONFIG_USB_BECEEM) += madwimax-0.1.1 # for Samsung WiMAX
445obj-$(RTCONFIG_USB_BECEEM) += openssl-1.0.0q # for Beceem, GCT WiMAX
446obj-$(RTCONFIG_USB_BECEEM) += Beceem_BCMS250 # for Beceem WiMAX
447obj-$(RTCONFIG_USB_BECEEM) += wpa_supplicant-0.7.3 # for GCT WiMAX
448obj-$(RTCONFIG_USB_BECEEM) += zlib # for GCT WiMAX
449obj-$(RTCONFIG_USB_BECEEM) += gctwimax-0.0.3rc4 # for GCT WiMAX
450
451obj-y += libdisk
452
453#obj-y += dosfstools
454obj-$(RTCONFIG_FTP) += $(if $(RTCONFIG_QCA),vsftpd-3.x,vsftpd)
455
456#obj-$(RTCONFIG_EXT4FS) += e2fsprogs
457
458ifeq ($(CONFIG_LINUX26),y)
459ifeq ($(RTCONFIG_SAMBASRV),y)
460NEED_EX_NLS = y
461endif
462ifeq ($(RTCONFIG_USB_EXTRAS),y)
463NEED_EX_USB = y
464endif
465endif
466
467ifeq ($(RTCONFIG_SAMBASRV),y)
468ifeq ($(RTCONFIG_SAMBA3),y)
469NEED_SAMBA3 = y
470else
471NEED_SAMBA2 = y
472endif
473endif
474endif
475
476ifeq ($(RTCONFIG_IPV6),y)
477export RTCONFIG_IPV6 := y
478else
479RTCONFIG_IPV6 :=
480endif
481# install before samba3 for not overwriting some binaries
482obj-$(RTCONFIG_WEBDAV) += samba-3.5.8
483obj-$(NEED_SAMBA2) += samba
484ifeq ($(RTCONFIG_BCMARM),y)
485obj-$(NEED_SAMBA3) += samba-3.0.25b
486else
487obj-$(NEED_SAMBA3) += samba3
488endif
489ifeq ($(RTCONFIG_NTFS),y)
490obj-$(RTCONFIG_OPEN_NTFS3G) += ntfs-3g
491obj-$(RTCONFIG_PARAGON_NTFS) += ufsd
492obj-$(RTCONFIG_TUXERA_NTFS) += tuxera
493endif
494ifeq ($(RTCONFIG_HFS),y)
495obj-$(RTCONFIG_PARAGON_HFS) += ufsd
496obj-$(RTCONFIG_TUXERA_HFS) += tuxera
497obj-$(RTCONFIG_KERNEL_HFSPLUS) += diskdev_cmds-332.14
498endif
499obj-$(RTCONFIG_EBTABLES) += ebtables
500obj-$(RTCONFIG_IPV6) += odhcp6c
501obj-$(RTCONFIG_6RELAYD) += 6relayd
502#obj-$(RTCONFIG_IPV6) += ecmh
503
504obj-$(RTCONFIG_MEDIA_SERVER) += zlib
505obj-$(RTCONFIG_MEDIA_SERVER) += sqlite
506obj-$(RTCONFIG_MEDIA_SERVER) += ffmpeg
507obj-$(RTCONFIG_MEDIA_SERVER) += libogg
508obj-$(RTCONFIG_MEDIA_SERVER) += flac
509obj-$(RTCONFIG_MEDIA_SERVER) += jpeg
510obj-$(RTCONFIG_MEDIA_SERVER) += libexif
511obj-$(RTCONFIG_MEDIA_SERVER) += libid3tag
512obj-$(RTCONFIG_MEDIA_SERVER) += libvorbis
513obj-$(RTCONFIG_MEDIA_SERVER) += minidlna
514obj-$(RTCONFIG_MEDIA_SERVER) += libgdbm
515obj-$(RTCONFIG_MEDIA_SERVER) += mt-daapd
516#obj-$(RTCONFIG_MEDIA_SERVER) += mt-daapd-svn-1696
517
518#MEDIA_SERVER_STATIC=y
519
520#add by gauss for cloudsync
521obj-$(RTCONFIG_CLOUDSYNC) += openssl
522obj-$(RTCONFIG_CLOUDSYNC) += libxml2
523obj-$(RTCONFIG_CLOUDSYNC) += curl-7.21.7
524obj-$(RTCONFIG_CLOUDSYNC) += asuswebstorage
525obj-$(RTCONFIG_CLOUDSYNC) += inotify
526
527obj-$(RTCONFIG_CLOUDSYNC) += zlib # for neon
528obj-$(RTCONFIG_CLOUDSYNC) += neon
529obj-$(RTCONFIG_CLOUDSYNC) += webdav_client
530obj-$(RTCONFIG_DROPBOXCLIENT) += dropbox_client
531
532obj-$(RTCONFIG_FTPCLIENT) += libiconv-1.14
533obj-$(RTCONFIG_FTPCLIENT) += ftpclient
534obj-$(RTCONFIG_SAMBACLIENT) += sambaclient
535obj-$(RTCONFIG_USBCLIENT) += usbclient
536
537#aaews,asusnatnl related
538obj-$(RTCONFIG_TUNNEL) += wb
539obj-$(RTCONFIG_TUNNEL) += aaews
540obj-$(RTCONFIG_TUNNEL) += mastiff
541obj-$(RTCONFIG_TUNNEL) += asusnatnl
542
543
544#For timemachine
545obj-$(RTCONFIG_TIMEMACHINE) += openssl
546obj-$(RTCONFIG_TIMEMACHINE) += libgpg-error-1.10
547obj-$(RTCONFIG_TIMEMACHINE) += libgcrypt-1.5.1
548obj-$(RTCONFIG_TIMEMACHINE) += db-4.8.30
549obj-$(RTCONFIG_TIMEMACHINE) += netatalk-3.0.5
550ifeq ($(or $(RTCONFIG_TIMEMACHINE),$(RTCONFIG_MDNS)),y)
551obj-y += libdaemon
552obj-y += avahi-0.6.31
553obj-y += expat-2.0.1
554else
555ifeq ($(or $(RTCONFIG_MEDIA_SERVER),$(RTCONFIG_BWDPI)),y)
556obj-y += mDNSResponder
557endif
558endif
559
560#add for snmpd
561SNMPD_CFLAGS += -D$(BUILD_NAME)
562ifeq ($(BUILD_NAME), $(filter $(BUILD_NAME), RT-N66U RT-AC66U RT-AC68U))
563SNMPD_CFLAGS += -DDUAL_BAND
564endif
565obj-$(RTCONFIG_SNMPD) += openssl
566obj-$(RTCONFIG_SNMPD) += libnmp
567obj-$(RTCONFIG_SNMPD) += net-snmp-5.7.2
568ifeq ($(RTCONFIG_SNMPD),y)
569export MIB_MODULE_PASSPOINT =
570endif
571
572#
573# configurable packages
574#
575RTCONFIG_PPP_BASE = y
576obj-$(RTCONFIG_PPP_BASE) += pppd rp-pppoe
577obj-$(RTCONFIG_L2TP) += rp-l2tp
578obj-$(RTCONFIG_PPTP) += accel-pptp
579obj-$(RTCONFIG_EAPOL) += wpa_supplicant
580obj-$(RTCONFIG_HTTPS) += openssl
581obj-$(RTCONFIG_HTTPS) += wget zlib
582obj-$(RTCONFIG_SSH) += dropbear
583obj-$(RTCONFIG_WTFAST) += wtfast
584#obj-$(RTCONFIG_ZEBRA) += zebra
585obj-$(RTCONFIG_QUAGGA) += quagga
586#	obj-$(RTCONFIG_IPP2P) += ipp2p
587obj-$(RTCONFIG_LZO) += lzo
588obj-$(RTCONFIG_OPENVPN) += openpam
589obj-$(RTCONFIG_OPENVPN) += openvpn
590
591obj-$(CONFIG_LINUX26) += hotplug2
592obj-$(CONFIG_LINUX26) += udev
593
594obj-$(RTCONFIG_ACCEL_PPTPD) += accel-pptpd
595obj-$(RTCONFIG_PPTPD) += pptpd
596
597obj-$(RTCONFIG_WEBDAV) += sqlite
598obj-$(RTCONFIG_WEBDAV) += libxml2
599obj-$(RTCONFIG_WEBDAV) += pcre-8.31
600obj-$(RTCONFIG_WEBDAV) += lighttpd-1.4.39
601obj-$(RTCONFIG_WEBDAV) += libexif
602
603obj-$(RTCONFIG_IXIAEP) += ixia_endpoint$(BCMEX)
604
605# Add for ASUS Components
606obj-$(RTCONFIG_UPNPC) += miniupnpc
607obj-y += miniupnpd$(MUVER)
608obj-y += igmpproxy
609obj-y += snooper
610ifeq ($(RTCONFIG_BCMWL6),y)
611ifneq ($(RTCONFIG_BCMARM),y)
612obj-y += netconf
613obj-y += igmp
614endif
615endif
616obj-y += udpxy
617ifeq ($(CONFIG_BCMWL5),y)
618ifeq ($(RTCONFIG_BCMARM),y)
619obj-y += lltd.arm
620obj-y += taskset
621obj-$(RTCONFIG_COMA) += comad
622else
623obj-y += lltd
624endif
625ifeq ($(RTCONFIG_BCMWL6),y)
626#ifneq ($(RTCONFIG_BCM10),y)
627obj-y += acsd$(BCMEX)$(EX7)
628#endif
629endif
630else
631obj-y += lldt
632endif
633obj-$(RTCONFIG_JFFS2USERICON) += lltdc
634
635obj-$(RTCONFIG_TOAD) += toad
636obj-$(RTCONFIG_BCMBSD) += bsd
637obj-$(RTCONFIG_BCMSSD) += ssd
638obj-y += networkmap
639obj-y += infosvr
640obj-y += ez-ipupdate
641ifneq ($(or $(RTN56U),$(DSLN55U)),y)
642obj-y += phddns
643endif
644
645obj-$(RTCONFIG_STRACE) += strace
646
647obj-$(RTCONFIG_GDB) += gdb
648obj-$(RTCONFIG_LLDP) += openlldp
649
650obj-n += lsof
651obj-$(RTCONFIG_IPERF) += iperf
652
653obj-$(RTCONFIG_PUSH_EMAIL) += zlib # for libxml2, curl.
654obj-$(RTCONFIG_PUSH_EMAIL) += openssl
655obj-$(RTCONFIG_PUSH_EMAIL) += libxml2
656obj-$(RTCONFIG_PUSH_EMAIL) += curl-7.21.7
657obj-$(RTCONFIG_PUSH_EMAIL) += wb
658obj-$(RTCONFIG_PUSH_EMAIL) += email-3.1.3
659obj-$(RTCONFIG_PUSH_EMAIL) += push_log
660
661obj-$(RTCONFIG_NORTON) += norton${BCMEX}
662
663obj-$(UBI) += mtd-utils
664obj-$(UBIFS) += mtd-utils
665obj-$(UBIFS) += util-linux lzo zlib
666ifeq ($(RTCONFIG_RALINK),y)
667obj-$(RA_SKU) += ra_SingleSKU
668endif
669obj-$(RTCONFIG_BCMARM) += wl$(BCMEX)$(EX7)
670obj-$(RTCONFIG_BCMARM) += et_arm$(EX7)
671
672obj-$(RTCONFIG_EXT_RTL8365MB) += rtl_bin
673obj-$(RTCONFIG_EXT_RTL8370MB) += rtl_bin
674obj-$(RTCONFIG_LACP) += lacp
675
676#obj-y += bonnie
677
678ifeq ($(RTN65U), y)
679obj-y += asm1042
680endif
681
682ifeq ($(RTCONFIG_BCMARM),y)
683obj-prelibs =$(filter nvram$(BCMEX) libbcmcrypto shared netconf libupnp$(BCMEX)$(EX7) libz libbcm pciefd, $(obj-y))
684obj-postlibs := $(filter-out $(obj-prelibs), $(obj-y))
685endif
686
687ifneq ($(RTCONFIG_4M_SFP),y)
688obj-y += netstat-nat
689endif
690
691obj-$(RTCONFIG_TCPDUMP) += libpcap
692obj-$(RTCONFIG_TCPDUMP) += tcpdump-4.4.0
693
694obj-$(RTCONFIG_BLINK_LED) += bled
695obj-$(RTCONFIG_BONDING) += ifenslave
696
697obj-$(RTCONFIG_GEOIP) += GeoIP-1.6.2
698
699obj-$(RTCONFIG_TRANSMISSION) += Transmission curl-7.21.7 libevent-2.0.21
700
701ifeq ($(RTCONFIG_TOR),y)
702obj-y += openssl
703obj-y += zlib
704obj-y += libevent-2.0.21
705obj-y += tor-0.2.5.10
706endif
707
708#For TR-069 agent
709obj-$(RTCONFIG_TR069) += openssl
710obj-$(RTCONFIG_TR069) += tr069
711
712obj-$(RTCONFIG_CLOUDCHECK) += cloudcheck
713
714obj-$(RTCONFIG_GETREALIP) += ministun
715
716
717ifneq ($(find lighttpd-1.4.39, $(obj-y)),"")
718released_dir += APP-IPK
719endif
720
721obj-clean := $(foreach obj, $(obj-y) $(obj-n) $(obj-), $(obj)-clean)
722obj-install := $(foreach obj,$(obj-y),$(obj)-install)
723
724ifneq ($(or $(findstring linux-2.6.36.x,$(LINUXDIR)),$(findstring linux-3.x,$(LINUXDIR)),$(findstring linux-3.3.x,$(LINUXDIR))),)
725MKSQUASHFS_TARGET = mksquashfs
726else
727MKSQUASHFS_TARGET = mksquashfs-lzma
728endif
729MKSQUASHFS = $(MKSQUASHFS_TARGET)
730
731ifneq ($(or $(findstring linux-3.x,$(LINUXDIR)),$(findstring linux-3.3.x,$(LINUXDIR))),)
732LINUX_ARCH_ASM_INCL_DIR=$(LINUXDIR)/arch/mips/include/asm
733else
734LINUX_ARCH_ASM_INCL_DIR=$(LINUXDIR)/include/asm-mips
735endif
736
737#
738# Basic rules
739#
740
741all: clean-build kernel_header libc version obj_prelibs kernel $(obj-y)
742
743ifeq ($(RTCONFIG_BCMARM),y)
744version:  $(SRCBASE)/include/epivers.h
745
746$(SRCBASE)/include/epivers.h:
747	$(MAKE) -C $(SRCBASE)/include
748ifeq ($(RTCONFIG_DHDAP),y)
749	$(MAKE) -C $(SRCBASE_DHD)/include
750	$(MAKE) -C $(SRCBASE_FW)/include
751endif
752endif
753
754ifeq ($(RTCONFIG_BCMARM),y)
755	+$(MAKE) $(MAKE_ARGS) post_preplibs
756endif
757
758ifeq ($(RTCONFIG_BCMARM),y)
759obj_prelibs:
760	+$(MAKE) parallel=true $(MAKE_ARGS) $(obj-prelibs)
761
762obj_postlibs:
763	+$(MAKE) parallel=true $(MAKE_ARGS) $(obj-postlibs)
764
765post_preplibs:  obj_postlibs
766else
767obj_prelibs: dummy
768endif
769
770ifneq ($(RTCONFIG_BCMARM),y)
771kernel_header: $(LINUXDIR)/.config
772	$(MAKE) -C $(LINUXDIR) ARCH=$(ARCH) headers_install INSTALL_HDR_PATH=$(TOP)/$@
773ifeq ($(RTCONFIG_RALINK),y)
774	@if [ -e $(LINUX_ARCH_ASM_INCL_DIR)/rt2880/rt_mmap.h ] ; then \
775		mkdir -p $@/include/asm/rt2880 ; \
776		cp $(LINUX_ARCH_ASM_INCL_DIR)/rt2880/rt_mmap.h $@/include/asm/rt2880/ ; \
777	fi
778endif
779ifeq ($(RTCONFIG_QCA),y)
780	cp $(LINUXDIR)/include/net/switch.h $@/include/linux/
781endif
782	$(MAKE) -C $(LINUXDIR) prepare scripts
783	find $(LINUXDIR)/include -name autoconf.h -exec cp {} $@/include/linux/ \;
784	cp $(LINUXDIR)/Makefile $@/
785else
786kernel_header: $(LINUXDIR)/.config
787
788endif
789
790kernel: $(LINUXDIR)/.config
791	$(SEP)
792
793ifneq ($(RTCONFIG_BCMARM),y)
794ifeq ($(RTCONFIG_RALINK),y)
795	@if ! grep -q "CONFIG_EMBEDDED_RAMDISK=y" $(LINUXDIR)/.config ; then \
796		$(MAKE) -C $(LINUXDIR) vmlinux CC=$(KERNELCC) LD=$(KERNELLD); \
797	fi
798	if grep -q "CONFIG_MODULES=y" $(LINUXDIR)/.config ; then \
799		$(MAKE) -C $(LINUXDIR) modules CC=$(KERNELCC) LD=$(KERNELLD); \
800	fi
801else ifeq ($(RTCONFIG_QCA),y)
802	$(MAKE) -C $(LINUXDIR) vmlinux CC=$(KERNELCC) LD=$(KERNELLD)
803	if grep -q "CONFIG_MODULES=y" $(LINUXDIR)/.config ; then \
804	    $(MAKE) -C $(LINUXDIR) modules CC=$(KERNELCC) LD=$(KERNELLD); \
805	fi
806else
807	# Broadcrom MIPS SoC
808	@if ! grep -q "CONFIG_EMBEDDED_RAMDISK=y" $(LINUXDIR)/.config ; then \
809		$(MAKE) -C $(LINUXDIR) zImage CC=$(KERNELCC); \
810	fi
811	if grep -q "CONFIG_MODULES=y" $(LINUXDIR)/.config ; then \
812		$(MAKE) -C $(LINUXDIR) modules CC=$(KERNELCC); \
813	fi
814
815ifeq ($(CONFIG_LINUX26),y)
816	$(MAKE) -C $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed srctree=$(LINUXDIR)
817endif
818endif
819else	# RTCONFIG_BCMARM
820	(echo '.NOTPARALLEL:' ; cat ${LINUXDIR}/Makefile) |\
821		$(MAKE) -C ${LINUXDIR} -f - $(SUBMAKE_SETTINGS) zImage
822	+$(MAKE) CONFIG_SQUASHFS=$(CONFIG_SQUASHFS) -C $(SRCBASE)/router/compressed ARCH=$(ARCH)
823
824	$(if $(shell grep "CONFIG_MODULES=y" ${LINUXDIR}/.config), \
825	(echo '.NOTPARALLEL:' ; cat ${LINUXDIR}/Makefile) | $(MAKE) -C ${LINUXDIR} -f - $(SUBMAKE_SETTINGS) MFG_WAR=1 zImage ; \
826	(echo '.NOTPARALLEL:' ; cat ${LINUXDIR}/Makefile) | $(MAKE) -C ${LINUXDIR} -f - ARCH=$(ARCH) modules)
827	# Preserve the debug versions of these and strip for release
828	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/vmlinux)
829	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/net/wl/wl.ko)
830	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/net/et/et.ko)
831	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/net/ctf/ctf.ko)
832	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/net/dhd/dhd.ko)
833	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/net/bcm57xx/bcm57xx.ko)
834	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/net/emf/emf.ko)
835	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/net/igs/igs.ko)
836	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/connector/cn.ko)
837	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/scsi/scsi_wait_scan.ko)
838	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/usb/host/xhci-hcd.ko)
839	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/usb/host/ehci-hcd.ko)
840	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/usb/host/ohci-hcd.ko)
841	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/lib/libcrc32c.ko)
842	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/net/sched/sch_tbf.ko)
843	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/net/sched/sch_hfsc.ko)
844ifeq ($(RTCONFIG_EXT_RTL8365MB),y)
845	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/char/rtl8365mb/rtl8365mb.ko)
846endif
847ifeq ($(RTCONFIG_RTL8370MB),y)
848	$(call STRIP_DEBUG_SYMBOLS,$(LINUXDIR)/drivers/char/rtl8365mb/rtl8365mb.ko)
849endif
850endif   # RTCONFIG_BCMARM
851
852ifeq ($(RTCONFIG_RALINK),y)
853else ifeq ($(RTCONFIG_QCA),y)
854else
855ifneq ($(RTCONFIG_BCMARM),y)
856lzma-loader:
857	$(MAKE) -C $(SRCBASE)/lzma-loader CROSS_COMPILE=$(CROSS_COMPILE) LD=$(LD)
858
859lzma-loader-install: lzma-loader
860	@$(SEP)
861endif
862endif
863
864kmod: dummy
865	$(MAKE) -C $(LINUXDIR) modules CC=$(KERNELCC)
866
867testfind:
868	cd $(TARGETDIR)/lib/modules/* && find -name "*.o" -exec mv -i {} . \; || true
869	cd $(TARGETDIR)/lib/modules/* && find -type d -delete || true
870
871install package: $(obj-install) $(LINUXDIR)/.config gen_target gen_gpl_excludes_router
872
873gen_target:
874	@$(SEP)
875
876	install -d $(TARGETDIR)
877
878
879# kernel modules
880	$(MAKE) -C $(LINUXDIR) modules_install DEPMOD=/bin/true INSTALL_MOD_PATH=$(TARGETDIR)
881	@if grep -q "CONFIG_RT3352_INIC_AP=y" $(LINUXDIR)/.config ; then \
882		install -d $(TARGETDIR)/iNIC_RT3352/ ; \
883		install -D $(LINUXDIR)/drivers/net/wireless/iNIC_RT3352/firmware/mii/iNIC_ap.bin $(TARGETDIR)/iNIC_RT3352/ ; \
884	else \
885		rm -rf $(TARGETDIR)/iNIC_RT3352/ ; \
886	fi
887##!!TB	find $(TARGETDIR)/lib/modules -name *.o -exec mipsel-linux-strip --strip-unneeded {} \;
888	find $(TARGETDIR)/lib/modules -name *.o -exec $(STRIP) --strip-debug -x -R .comment -R .pdr -R .mdebug.abi32 -R .note.gnu.build-id -R .gnu.attributes -R .reginfo {} \;
889	find $(TARGETDIR)/lib/modules -name *.ko -exec $(STRIP) --strip-debug -x -R .comment -R .pdr -R .mdebug.abi32 -R .note.gnu.build-id -R .gnu.attributes -R .reginfo {} \;
890#	-cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv diag/* . && rm -rf diag
891
892# nice and clean
893ifeq ($(RTCONFIG_RALINK)$(RTCONFIG_QCA),y)
894	-cd $(TARGETDIR)/lib/modules/*/kernel/drivers/ && mv nvram$(BCMEX)/* . && rm -rf nvram$(BCMEX) || true
895else
896	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv et.4702/* . && rm -rf et.4702 || true
897	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv et/* . && rm -rf et || true
898ifeq ($(RTCONFIG_BRCM_USBAP),y)
899	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv wl/wl_high.ko . || true
900	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv wl/wl_high/wl_high.ko . || true
901	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv wl/wl_sta/wl_high.ko . || true
902endif
903	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv wl/wl.ko . && rm -rf wl || true
904endif
905	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv cifs/* . && rm -rf cifs || true
906	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv jffs2/* . && rm -rf jffs2 || true
907	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv jffs/* . && rm -rf jffs || true
908	cd $(TARGETDIR)/lib/modules/*/kernel/lib && mv zlib_inflate/* . && rm -rf zlib_inflate || true
909	cd $(TARGETDIR)/lib/modules/*/kernel/lib && mv zlib_deflate/* . && rm -rf zlib_deflate || true
910	cd $(TARGETDIR)/lib/modules/*/kernel/lib && mv lzo/* . && rm -rf lzo || true
911	rm -rf $(TARGETDIR)/lib/modules/*/pcmcia
912
913##!!TB
914	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv ext2/* . && rm -rf ext2 || true
915	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv ext3/* . && rm -rf ext3 || true
916	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv jbd/* . && rm -rf jbd || true
917	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv fat/* . && rm -rf fat || true
918	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv vfat/* . && rm -rf vfat || true
919	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv msdos/* . && rm -rf msdos || true
920	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv fuse/* . && rm -rf fuse || true
921	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv ntfs/* . && rm -rf ntfs || true
922	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv smbfs/* . && rm -rf smbfs || true
923	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv reiserfs/* . && rm -rf reiserfs || true
924	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv hfsplus/* . && rm -rf hfsplus || true
925	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv lockd/* . && rm -rf lockd || true
926	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv nfsd/* . && rm -rf nfsd || true
927	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv nfs/* . && rm -rf nfs || true
928	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv xfs/* . && rm -rf xfs || true
929	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv nls/* . && rm -rf nls || true
930	cd $(TARGETDIR)/lib/modules/*/kernel/fs && mv exportfs/* . && rm -rf exportfs || true
931	cd $(TARGETDIR)/lib/modules/*/kernel/net && mv sunrpc/* . && rm -rf sunrpc || true
932	cd $(TARGETDIR)/lib/modules/*/kernel/net && mv auth_gss/* . && rm -rf auth_gss || true
933	cd $(TARGETDIR)/lib/modules/*/kernel/sound/core && mv oss/* . && rm -rf oss || true
934	cd $(TARGETDIR)/lib/modules/*/kernel/sound/core && mv seq/* . && rm -rf seq || true
935	cd $(TARGETDIR)/lib/modules/*/kernel/sound && mv core/* . && rm -rf core || true
936	cd $(TARGETDIR)/lib/modules/*/kernel/sound && mv usb/* . && rm -rf usb || true
937	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/usb && mv hcd/* . && rm -rf hcd || true
938	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/usb && mv host/* . && rm -rf host || true
939	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/usb && mv storage/* . && rm -rf storage || true
940	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/usb && mv serial/* . && rm -rf serial || true
941	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/usb && mv core/* . && rm -rf core || true
942	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/usb && mv class/* . && rm -rf class || true
943	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/usb && mv misc/* . && rm -rf misc || true
944	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/hid && mv usbhid/* . && rm -rf usbhid || true
945	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/input && mv joystick/* . && rm -rf joystick || true
946	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/input && mv keyboard/* . && rm -rf keyboard || true
947	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/input && mv misc/* . && rm -rf misc || true
948	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/input && mv mouse/* . && rm -rf mouse || true
949	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/media/video && mv uvc/* . && rm -rf uvc || true
950	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/media && mv video/* . && rm -rf video || true
951
952	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv bcm57xx/* . && rm -rf bcm57xx || true
953	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv emf/* . && rm -rf emf || true
954	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv igs/* . && rm -rf igs || true
955ifeq ($(RTAC53U),y)
956	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv ctf_5358/* . && rm -rf ctf_5358 || true
957else
958	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/net && mv ctf/* . && rm -rf ctf || true
959endif
960ifeq ($(RTCONFIG_EXT_RTL8365MB),y)
961	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/char && mv rtl8365mb/* . && rm -rf rtl8365mb || true
962endif
963ifeq ($(RTCONFIG_RTL8370MB),y)
964	cd $(TARGETDIR)/lib/modules/*/kernel/drivers/char && mv rtl8365mb/* . && rm -rf rtl8365mb || true
965endif
966	cd $(TARGETDIR)/lib/modules && rm -f */source || true
967
968# misc
969	for dir in $(wildcard $(patsubst %,$(INSTALLDIR)/%,$(obj-y))) ; do \
970		(cd $${dir} && tar cpf - .) | (cd $(TARGETDIR) && tar xpf -) \
971	done
972
973ifneq ($(RTCONFIG_L7),y)
974	rm -f $(TARGETDIR)/usr/lib/iptables/libipt_layer7.so
975endif
976ifneq ($(RTCONFIG_SNMPD),y)
977	rm -f $(TARGETDIR)/usr/lib/libnmp.so
978endif
979
980# uClibc
981	install $(LIBDIR)/ld-uClibc.so.0 $(TARGETDIR)/lib/
982	install $(LIBDIR)/libcrypt.so.0 $(TARGETDIR)/lib/
983	install $(LIBDIR)/libpthread.so.0 $(TARGETDIR)/lib/
984	install $(LIBDIR)/libgcc_s.so.1 $(TARGETDIR)/lib/
985	$(STRIP) $(TARGETDIR)/lib/libgcc_s.so.1
986	install $(LIBDIR)/libc.so.0 $(TARGETDIR)/lib/
987	install $(LIBDIR)/libdl.so.0 $(TARGETDIR)/lib/
988	install $(LIBDIR)/libm.so.0 $(TARGETDIR)/lib/
989	install $(LIBDIR)/libnsl.so.0 $(TARGETDIR)/lib/
990ifeq ($(RTCONFIG_SSH),y)
991	install $(LIBDIR)/libutil.so.0 $(TARGETDIR)/lib/
992endif
993ifneq ($(RTCONFIG_OPTIMIZE_SHARED_LIBS),y)
994	install $(LIBDIR)/libresolv.so.0 $(TARGETDIR)/lib/
995	$(STRIP) $(TARGETDIR)/lib/*.so.0
996endif
997
998	@cd $(TARGETDIR) && $(TOP)/others/rootprep${BCMEX}.sh
999	@echo ---
1000
1001ifeq ($(RTCONFIG_QCA),y)
1002	#FIXME
1003else
1004ifeq ($(RTCONFIG_OPTIMIZE_SHARED_LIBS),y)
1005ifneq ($(RTCONFIG_BCMARM),y)
1006	@$(SRCBASE)/btools/libfoo.pl
1007endif
1008else
1009	@$(SRCBASE)/btools/libfoo.pl --noopt
1010endif
1011endif
1012
1013	@chmod 0555 $(TARGETDIR)/lib/*.so*
1014	@chmod 0555 $(TARGETDIR)/usr/lib/*.so*
1015
1016# !!TB - moved to run after libfoo.pl - to make sure shared libs include all symbols needed by extras
1017# separated/copied extra stuff
1018	@rm -rf $(PLATFORMDIR)/extras
1019	@mkdir $(PLATFORMDIR)/extras
1020	@mv $(TARGETDIR)/lib/modules/*/kernel/net/ipv4/ip_gre.*o $(PLATFORMDIR)/extras/ || true
1021
1022	$(if $(RTCONFIG_OPENVPN),@cp -f,$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv)) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/tun.*o $(PLATFORMDIR)/extras/ || true
1023	$(if $(RTCONFIG_EBTABLES),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/net/bridge/netfilter/ebt*.*o $(PLATFORMDIR)/extras/ || true
1024
1025	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/net/ifb.*o $(PLATFORMDIR)/extras/ || true
1026	@mv $(TARGETDIR)/lib/modules/*/kernel/net/sched/sch_red.*o $(PLATFORMDIR)/extras/ || true
1027	@mv $(TARGETDIR)/lib/modules/*/kernel/fs/ntfs.*o $(PLATFORMDIR)/extras/ || true
1028	@mv $(TARGETDIR)/lib/modules/*/kernel/fs/smbfs.*o $(PLATFORMDIR)/extras/ || true
1029	@mv $(TARGETDIR)/lib/modules/*/kernel/fs/reiserfs.*o $(PLATFORMDIR)/extras/ || true
1030	@mv $(TARGETDIR)/lib/modules/*/kernel/fs/hfsplus.*o $(PLATFORMDIR)/extras/ || true
1031	@mv $(TARGETDIR)/lib/modules/*/kernel/fs/nfs.*o $(PLATFORMDIR)/extras/ || true
1032	@mv $(TARGETDIR)/lib/modules/*/kernel/fs/nfsd.*o $(PLATFORMDIR)/extras/ || true
1033	@mv $(TARGETDIR)/lib/modules/*/kernel/fs/lockd.*o $(PLATFORMDIR)/extras/ || true
1034	@mv $(TARGETDIR)/lib/modules/*/kernel/fs/exportfs.*o $(PLATFORMDIR)/extras/ || true
1035	@mv $(TARGETDIR)/lib/modules/*/kernel/net/sunrpc.*o $(PLATFORMDIR)/extras/ || true
1036	@mv $(TARGETDIR)/lib/modules/*/kernel/net/auth_rpcgss.*o $(PLATFORMDIR)/extras/ || true
1037	@mv $(TARGETDIR)/lib/modules/*/kernel/net/rpcsec_gss_krb5.*o $(PLATFORMDIR)/extras/ || true
1038	@mv $(TARGETDIR)/lib/modules/*/kernel/fs/xfs.*o $(PLATFORMDIR)/extras/ || true
1039#	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/scsi/sr_mod.*o $(PLATFORMDIR)/extras/ || true
1040	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/scanner.*o $(PLATFORMDIR)/extras/ || true
1041
1042	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/usbserial.*o $(PLATFORMDIR)/extras/ || true
1043	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/option.*o $(PLATFORMDIR)/extras/ || true
1044	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/*acm.*o $(PLATFORMDIR)/extras/ || true
1045	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/cdc-wdm.*o $(PLATFORMDIR)/extras/ || true
1046	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/usb/usbnet.*o $(PLATFORMDIR)/extras/ || true
1047	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/usb/asix.*o $(PLATFORMDIR)/extras/ || true
1048	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/usb/cdc_ether.*o $(PLATFORMDIR)/extras/ || true
1049	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/usb/rndis_host.*o $(PLATFORMDIR)/extras/ || true
1050	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/usb/cdc_ncm.*o $(PLATFORMDIR)/extras/ || true
1051	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/usb/qmi_wwan.*o $(PLATFORMDIR)/extras/ || true
1052	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/usb/cdc_mbim.*o $(PLATFORMDIR)/extras/ || true
1053	$(if $(RTCONFIG_USB_MODEM),@cp -rf,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/usb/hso* $(PLATFORMDIR)/extras/ || true
1054	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/usb/ipheth.*o $(PLATFORMDIR)/extras/ || true
1055	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/sierra.*o $(PLATFORMDIR)/extras/ || true
1056
1057	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/usbkbd.*o $(PLATFORMDIR)/extras/ || true
1058	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/usbmouse.*o $(PLATFORMDIR)/extras/ || true
1059	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/hid*.*o $(PLATFORMDIR)/extras/ || true
1060	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/ipw.*o $(PLATFORMDIR)/extras/ || true
1061	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/audio.*o $(PLATFORMDIR)/extras/ || true
1062	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/ov51*.*o $(PLATFORMDIR)/extras/ || true
1063	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/pwc*.*o $(PLATFORMDIR)/extras/ || true
1064	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/emi*.*o $(PLATFORMDIR)/extras/ || true
1065	@cp -f $(TARGETDIR)/lib/modules/*/kernel/drivers/net/mii.*o $(PLATFORMDIR)/extras/ || true
1066	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/media/* $(PLATFORMDIR)/extras/ || true
1067	@rm -rf $(TARGETDIR)/lib/modules/*/kernel/drivers/media || true
1068	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/sound/* $(PLATFORMDIR)/extras/ || true
1069	@rm -rf $(TARGETDIR)/lib/modules/*/kernel/drivers/sound || true
1070	@mv $(TARGETDIR)/lib/modules/*/kernel/sound/* $(PLATFORMDIR)/extras/ || true
1071	@rm -rf $(TARGETDIR)/lib/modules/*/kernel/sound || true
1072	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/input/* $(PLATFORMDIR)/extras/ || true
1073	@rm -rf $(TARGETDIR)/lib/modules/*/kernel/drivers/input || true
1074	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/hid/* $(PLATFORMDIR)/extras/ || true
1075	@rm -rf $(TARGETDIR)/lib/modules/*/kernel/drivers/hid || true
1076	@cp -f $(TARGETDIR)/lib/modules/*/kernel/drivers/net/bcm57*.*o $(PLATFORMDIR)/extras/ || true
1077	$(if $(RTCONFIG_PPTP),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/pptp.*o $(PLATFORMDIR)/extras/ || true
1078	$(if $(RTCONFIG_L2TP),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/net/pppol2tp.*o $(PLATFORMDIR)/extras/ || true
1079	@mv $(TARGETDIR)/lib/modules/*/kernel/drivers/net/ppp_deflate.*o  $(PLATFORMDIR)/extras/ || true
1080	@mv $(TARGETDIR)/lib/modules/*/kernel/crypto/* $(PLATFORMDIR)/extras/ || true
1081	@rm -rf $(TARGETDIR)/lib/modules/*/kernel/crypto || true
1082
1083	$(if $(NEED_EX_NLS),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/nls_cp9*.*o $(PLATFORMDIR)/extras/ || true
1084	$(if $(NEED_EX_NLS),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/nls_cp1251.*o $(PLATFORMDIR)/extras/ || true
1085	$(if $(NEED_EX_NLS),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/nls_euc-jp.*o $(PLATFORMDIR)/extras/ || true
1086	$(if $(NEED_EX_NLS),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/nls_sjis.*o $(PLATFORMDIR)/extras/ || true
1087	$(if $(NEED_EX_NLS),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/nls_gb2312.*o $(PLATFORMDIR)/extras/ || true
1088	$(if $(NEED_EX_NLS),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/nls_euc-kr.*o $(PLATFORMDIR)/extras/ || true
1089	$(if $(NEED_EX_NLS),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/nls_big5.*o $(PLATFORMDIR)/extras/ || true
1090
1091	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/nls_*.*o $(PLATFORMDIR)/extras/ || true
1092	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/usb/*.*o $(PLATFORMDIR)/extras/ || true
1093	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/cdrom/*.*o $(PLATFORMDIR)/extras/ || true
1094	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/scsi/*.*o $(PLATFORMDIR)/extras/ || true
1095	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/ext2.*o $(PLATFORMDIR)/extras/ || true
1096	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/ext3.*o $(PLATFORMDIR)/extras/ || true
1097	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/jbd.*o $(PLATFORMDIR)/extras/ || true
1098	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/mbcache.*o $(PLATFORMDIR)/extras/ || true
1099	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/fat.*o $(PLATFORMDIR)/extras/ || true
1100	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/vfat.*o $(PLATFORMDIR)/extras/ || true
1101	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/msdos.*o $(PLATFORMDIR)/extras/ || true
1102	$(if $(RTCONFIG_USB),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/fuse.*o $(PLATFORMDIR)/extras/ || true
1103ifneq ($(RTCONFIG_USB),y)
1104	@rm -rf $(TARGETDIR)/lib/modules/*/kernel/drivers/usb || true
1105	@rm -rf $(TARGETDIR)/lib/modules/*/kernel/drivers/scsi || true
1106	@rm -rf $(TARGETDIR)/lib/modules/*/kernel/drivers/net/usb || true
1107endif
1108
1109	$(if $(RTCONFIG_USB_EXTRAS),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/connector/cn.*o $(PLATFORMDIR)/extras/ || true
1110	$(if $(RTCONFIG_USB_EXTRAS),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/drivers/block/loop.*o $(PLATFORMDIR)/extras/ || true
1111ifneq ($(RTCONFIG_USB_EXTRAS),y)
1112	@rm -rf $(TARGETDIR)/lib/modules/*/kernel/drivers/connector || true
1113	@rm -rf $(TARGETDIR)/lib/modules/*/kernel/drivers/block || true
1114endif
1115	$(if $(RTCONFIG_CIFS),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/cifs.*o $(PLATFORMDIR)/extras/ || true
1116	$(if $(or $(RTCONFIG_BRCM_NAND_JFFS2),$(RTCONFIG_JFFS2)),$(if $(RTCONFIG_JFFSV1),@mv,@cp -f),@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/jffs2.*o $(PLATFORMDIR)/extras/ || true
1117	$(if $(or $(RTCONFIG_BRCM_NAND_JFFS2),$(RTCONFIG_JFFS2)),$(if $(RTCONFIG_JFFSV1),@mv,@cp -f),@mv) $(TARGETDIR)/lib/modules/*/kernel/lib/zlib_*.*o $(PLATFORMDIR)/extras/ || true
1118	$(if $(or $(RTCONFIG_BRCM_NAND_JFFS2),$(RTCONFIG_JFFS2)),$(if $(RTCONFIG_JFFSV1),@cp -f,@mv),@mv) $(TARGETDIR)/lib/modules/*/kernel/fs/jffs.*o $(PLATFORMDIR)/extras/ || true
1119	[ ! -f $(TARGETDIR)/lib/modules/*/kernel/lib/* ] && rm -rf $(TARGETDIR)/lib/modules/*/kernel/lib || true
1120	$(if $(RTCONFIG_L7),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/net/ipv4/netfilter/ipt_layer7.*o $(PLATFORMDIR)/extras/ || true
1121	$(if $(RTCONFIG_L7),@cp -f,@mv) $(TARGETDIR)/lib/modules/*/kernel/net/netfilter/xt_layer7.*o $(PLATFORMDIR)/extras/ || true
1122
1123	@mkdir -p $(TARGETDIR)/asus_jffs
1124	@mkdir -p $(PLATFORMDIR)/extras/apps
1125	@mkdir -p $(PLATFORMDIR)/extras/lib
1126
1127	@mv $(TARGETDIR)/usr/sbin/ttcp $(PLATFORMDIR)/extras/apps/ || true
1128	@cp -f $(TARGETDIR)/usr/sbin/mii-tool $(PLATFORMDIR)/extras/apps/ || true
1129	$(if $(RTCONFIG_RALINK),@mv,@cp -f)  $(TARGETDIR)/usr/sbin/robocfg $(PLATFORMDIR)/extras/apps/ || true
1130
1131	$(if $(NEED_EX_USB),@cp -f,@mv) $(TARGETDIR)/usr/lib/libusb* $(PLATFORMDIR)/extras/lib/ || true
1132	$(if $(RTCONFIG_USB_MODEM),@cp -f,@mv) $(TARGETDIR)/usr/sbin/chat $(PLATFORMDIR)/extras/apps/ || true
1133
1134	@mkdir -p $(TARGETDIR)/rom/etc/l7-protocols
1135ifeq ($(RTCONFIG_L7PAT),y)
1136	@cd layer7 && ./squish.sh
1137	cp layer7/squished/*.pat $(TARGETDIR)/rom/etc/l7-protocols
1138endif
1139
1140	busybox/examples/depmod.pl -k $(LINUXDIR)/vmlinux -b $(TARGETDIR)/lib/modules/*/
1141ifneq ($(RTCONFIG_BCMARM),y)
1142	mv $(TARGETDIR)/lib/modules/$(LINUX_KERNEL)/modules.dep $(TARGETDIR)/lib/modules/
1143else
1144	mv $(TARGETDIR)/lib/modules/*/modules.dep $(TARGETDIR)/lib/modules/
1145endif
1146
1147ifeq ($(RTCONFIG_ROMCFE),y)
1148	-cp $(SRCBASE)/cfe/cfe_`echo $(BUILD_NAME)|tr A-Z a-z`.bin $(TARGETDIR)/rom/cfe
1149endif
1150ifeq ($(RTCONFIG_ROMATECCODEFIX),y)
1151	-cp $(SRCBASE)/router/rom/cfe/`echo $(BUILD_NAME)|tr A-Z a-z`_fixlist.txt $(TARGETDIR)/rom/mac_chklist.txt
1152endif
1153ifeq ($(RTCONFIG_QTN),y)
1154	# install qtn boot-code and firmware
1155	install -D qtnimage/topaz-linux.lzma.img $(TARGETDIR)/rom/qtn/boot/topaz-linux.lzma.img
1156	install -D qtnimage/u-boot.bin $(TARGETDIR)/rom/qtn/boot/u-boot.bin
1157	ln -s /rom/qtn/boot/topaz-linux.lzma.img $(TARGETDIR)/rom/qtn/topaz-linux.lzma.img
1158	ln -s /rom/qtn/boot/u-boot.bin $(TARGETDIR)/rom/qtn/u-boot.bin
1159	install -D qtnimage/router_command.sh $(TARGETDIR)/rom/qtn/router_command.sh
1160	install -D qtnimage/qtn_dbg.sh $(TARGETDIR)/rom/qtn/qtn_dbg.sh
1161	install -D qtnimage/start-stateless-slave $(TARGETDIR)/rom/qtn/start-stateless-slave
1162	install -D qtnimage/tweak_qcomm $(TARGETDIR)/rom/qtn/tweak_qcomm
1163endif
1164ifeq ($(RTCONFIG_SPEEDTEST),y)
1165	# for speedtest
1166	install -D curl-7.21.7/src/.libs/curl $(TARGETDIR)/usr/sbin/curl
1167	install -D curl-7.21.7/ddns-start.sh $(TARGETDIR)/usr/sbin/ddns-start.sh
1168	$(STRIP) $(TARGETDIR)/usr/sbin/curl
1169endif
1170
1171ifeq ($(RTCONFIG_BWDPI),y)
1172	install -d $(TARGETDIR)/usr/bwdpi/
1173	cp -f bwdpi_bin/*.so $(TARGETDIR)/usr/lib/
1174	cp -f bwdpi_bin/*.so.0.1 $(TARGETDIR)/usr/lib/
1175	cp -f bwdpi_bin/*.ko $(TARGETDIR)/usr/bwdpi/
1176	cp -f bwdpi_bin/*.trf $(TARGETDIR)/usr/bwdpi/
1177	install -D bwdpi_bin/qosd $(TARGETDIR)/usr/sbin/qosd
1178	install -D bwdpi_bin/wred $(TARGETDIR)/usr/sbin/wred
1179	install -D bwdpi_bin/wred_set_conf $(TARGETDIR)/usr/sbin/wred_set_conf
1180	install -D bwdpi_bin/data_colld $(TARGETDIR)/usr/sbin/data_colld
1181	install -D bwdpi_bin/dc_monitor.sh $(TARGETDIR)/usr/sbin/dc_monitor.sh
1182	install -D bwdpi_bin/bwdpi-rule-agent $(TARGETDIR)/usr/sbin/bwdpi-rule-agent
1183	install -D bwdpi_bin/ntdasus2014.cert $(TARGETDIR)/usr/bwdpi/ntdasus2014.cert
1184	install -D $(shell dirname $(shell which $(CXX)))/../lib/librt.so.0 $(TARGETDIR)/lib/librt.so.0
1185endif
1186
1187ifeq ($(RTCONFIG_BCMARM),y)
1188ifeq ($(RTCONFIG_CFEZ),y)
1189	install -D envram_bin/envrams $(TARGETDIR)/usr/sbin/envrams
1190	install -D envram_bin/envram $(TARGETDIR)/usr/sbin/envram
1191endif
1192endif
1193
1194	@echo ---
1195
1196	@rm -f $(TARGETDIR)/lib/modules/*/build
1197
1198gen_gpl_excludes_router:
1199	@[ ! -d ../../../buildtools/ ] || ../../../buildtools/gpl_excludes_router.sh $(SRCBASE) "$(obj-y) $(released_dir)"
1200
1201image:
1202ifneq ($(RTCONFIG_BCMARM),y)
1203	@$(MAKE) -C $(LINUXDIR)/scripts/squashfs $(MKSQUASHFS_TARGET)
1204	@$(LINUXDIR)/scripts/squashfs/$(MKSQUASHFS) $(TARGETDIR) $(PLATFORMDIR)/target.image -all-root -noappend -nopad | tee target.info
1205else
1206	+$(MAKE) -C squashfs-4.2 mksquashfs
1207	squashfs-4.2/mksquashfs $(TARGETDIR) $(PLATFORMDIR)/$(ROOT_IMG) -noappend -all-root
1208endif
1209#	Package kernel and filesystem
1210#	if grep -q "CONFIG_EMBEDDED_RAMDISK=y" $(LINUXDIR)/.config ; then \
1211#		cp $(PLATFORMDIR)/target.image $(LINUXDIR)/arch/mips/ramdisk/$${CONFIG_EMBEDDED_RAMDISK_IMAGE} ; \
1212#		$(MAKE) -C $(LINUXDIR) zImage ; \
1213#	else \
1214#		cp $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/vmlinuz $(PLATFORMDIR)/ ; \
1215#		trx -o $(PLATFORMDIR)/linux.trx $(PLATFORMDIR)/vmlinuz $(PLATFORMDIR)/target.image ; \
1216#	fi
1217
1218# 	Pad self-booting Linux to a 64 KB boundary
1219#	cp $(LINUXDIR)/arch/mips/brcm-boards/bcm947xx/compressed/zImage $(PLATFORMDIR)/
1220#	dd conv=sync bs=64k < $(PLATFORMDIR)/zImage > $(PLATFORMDIR)/linux.bin
1221# 	Append filesystem to self-booting Linux
1222#	cat $(PLATFORMDIR)/target.image >> $(PLATFORMDIR)/linux.bin
1223
1224
1225libc:	$(LIBDIR)/ld-uClibc.so.0
1226#	$(MAKE) -C ../../../tools-src/uClibc all
1227#	$(MAKE) -C ../../../tools-src/uClibc install
1228
1229
1230#
1231# cleaners
1232#
1233
1234clean: clean-build $(obj-clean)
1235	rm -rf layer7/squished
1236	make -C config clean
1237
1238clean-build: dummy
1239	rm -rf $(TARGETDIR)
1240	rm -rf $(INSTALLDIR)
1241	rm -f $(PLATFORMDIR)/linux.trx $(PLATFORMDIR)/vmlinuz $(PLATFORMDIR)/target.image
1242	rm -rf $(PLATFORMDIR)/extras
1243	rm -rf kernel_header
1244
1245distclean: clean
1246ifneq ($(INSIDE_MAK),1)
1247	$(MAKE) -C $(SRCBASE) $@ INSIDE_MAK=1
1248endif
1249#	-rm -f $(LIBDIR)/*.so.0  $(LIBDIR)/*.so
1250
1251#
1252# configuration
1253#
1254
1255CONFIG_IN := config/config.in
1256
1257config/conf config/mconf:
1258	$(MAKE) -C config
1259
1260rconf: config/conf
1261	config/conf $(CONFIG_IN)
1262
1263rmconf: config/mconf
1264	config/mconf $(CONFIG_IN)
1265
1266roldconf: config/conf
1267	config/conf -o $(CONFIG_IN)
1268	$(MAKE) shared-clean libdisk-clean rc-clean nvram$(BCMEX)-clean httpd-clean prebuilt-clean libbcmcrypto-clean
1269#	@$(MAKE) iptables-clean ebtables-clean pppd-clean zebra-clean openssl-clean mssl-clean mdu-clean pppd-clean
1270	$(MAKE) dnsmasq-clean iproute2-clean networkmap-clean
1271ifeq ($(RTCONFIG_BCMARM),y)
1272	$(MAKE) compressed-clean
1273endif
1274ifeq ($(RTCONFIG_DHDAP),y)
1275ifeq ($(RTCONFIG_BCM7),y)
1276ifneq ($(wildcard $(SRCBASE_FW)/wl/sys),)
1277ifeq ($(wildcard /projects/hnd/tools/linux/hndtools-armeabi-2011.09),)
1278	# build 43602 src and to match its path
1279	sudo mkdir /projects/hnd/tools/linux -p
1280	sudo rm -rf /projects/hnd/tools/linux/hndtools-armeabi-2011.09
1281	sudo ln -sf $(SRCBASE)/toolchains/hndtools-armeabi-2011.09 /projects/hnd/tools/linux/hndtools-armeabi-2011.09
1282endif
1283endif
1284else ifeq ($(RTCONFIG_BCM_7114),y)
1285ifeq ($(wildcard /projects/hnd/tools/linux/hndtools-armeabi-2013.11),)
1286	# build pciefd
1287	sudo mkdir /projects/hnd/tools/linux/bin -p
1288	sudo rm -rf /projects/hnd/tools/linux/hndtools-armeabi-2013.11
1289	sudo ln -sf $(SRCBASE)/toolchains/hndtools-armeabi-2013.11 /projects/hnd/tools/linux/hndtools-armeabi-2013.11
1290	sudo ln -sf $(SRCBASE)/toolchains/fwtag.ini /projects/hnd/tools/linux/bin/fwtag.ini
1291endif
1292endif
1293endif
1294
1295kconf:
1296	$(MAKE) -C $(LINUXDIR) config
1297
1298kmconf:
1299	$(MAKE) -C $(LINUXDIR) menuconfig
1300
1301koldconf:
1302	$(MAKE) -C $(LINUXDIR) oldconfig
1303	$(MAKE) -C $(LINUXDIR) include/linux/version.h
1304
1305bboldconf:
1306	$(MAKE) -C busybox oldconfig
1307
1308config conf: rconf kconf
1309
1310menuconfig mconf: rmconf kmconf
1311
1312oldconfig oldconf: koldconf roldconf bboldconf
1313
1314
1315#
1316# overrides and extra dependencies
1317#
1318
1319busybox: dummy
1320	@$(MAKE) -C busybox EXTRA_CFLAGS="-fPIC $(EXTRACFLAGS)"
1321
1322# V=1
1323
1324busybox-install:
1325	rm -rf $(INSTALLDIR)/busybox
1326	$(MAKE) -C busybox install EXTRA_CFLAGS="-fPIC $(EXTRACFLAGS)" CONFIG_PREFIX=$(INSTALLDIR)/busybox
1327	chmod 4755 $(INSTALLDIR)/busybox/bin/busybox
1328
1329busybox-clean:
1330	$(MAKE) -C busybox distclean
1331
1332busybox-config:
1333	$(MAKE) -C busybox menuconfig
1334
1335infosvr: shared nvram${BCMEX}
1336
1337httpd: shared nvram$(BCMEX) libdisk $(if $(RTCONFIG_HTTPS),mssl) $(if $(RTCONFIG_PUSH_EMAIL),push_log) $(if $(RTCONFIG_BWDPI),bwdpi) $(if $(RTCONFIG_BWDPI),bwdpi_sqlite) json-c
1338
1339	@$(SEP)
1340	@$(MAKE) -C httpd
1341
1342bonnie: bonnie/Makefile
1343	$(MAKE) CXX=$(CXX) -C bonnie
1344
1345bonnie/Makefile:
1346	$(MAKE) bonnie-configure
1347
1348bonnie-configure:
1349	( cd bonnie ; \
1350		$(CONFIGURE) \
1351		--prefix=/usr \
1352		--bindir=/usr/sbin \
1353		--libdir=/usr/lib \
1354	)
1355
1356bonnie-install:
1357	install -D bonnie/bonnie++ $(INSTALLDIR)/bonnie/sbin/bonnie++
1358	$(STRIP) $(INSTALLDIR)/bonnie/sbin/bonnie++
1359ifeq ($(RTCONFIG_BCMARM),y)
1360	install -D $(shell dirname $(shell which $(CXX)))/../arm-brcm-linux-uclibcgnueabi/lib/libstdc++.so.6 $(INSTALLDIR)/bonnie/usr/lib/libstdc++.so.6
1361else
1362	install -D $(shell dirname $(shell which $(CXX)))/../lib/libstdc++.so.6 $(INSTALLDIR)/bonnie/usr/lib/libstdc++.so.6
1363endif
1364
1365bonnie-clean:
1366	[ ! -f bonnie/Makefile ] || $(MAKE) -C bonnie clean
1367	@rm -f bonnie/Makefile
1368
1369www-install:
1370	@$(MAKE) -C www install INSTALLDIR=$(INSTALLDIR)/www TOMATO_EXPERIMENTAL=$(TOMATO_EXPERIMENTAL)
1371
1372matrixssl:
1373	@$(SEP)
1374	@$(MAKE) -C matrixssl/src
1375
1376matrixssl-install:
1377	@true
1378
1379matrixssl-clean:
1380	-@$(MAKE) -C matrixssl/src clean
1381
1382cyassl/stamp-h1:
1383	@cd cyassl && CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD) \
1384	CFLAGS="-Os -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections \
1385	-DNO_MD4 -DNO_AES -DNO_ERROR_STRINGS -DNO_HC128 -DNO_RABBIT -DNO_PSK -DNO_DSA -DNO_DH -DNO_PWDBASED" \
1386	LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections -fPIC" \
1387	PTHREAD_CFLAGS="-lpthread" PTHREAD_LIBS="-lpthread" \
1388	$(CONFIGURE) --with-libz=no
1389	@touch $@
1390
1391cyassl: cyassl/stamp-h1
1392	@$(SEP)
1393	@$(MAKE) -C cyassl
1394
1395cyassl-clean:
1396	-@$(MAKE) -C cyassl clean
1397	@rm -f cyassl/stamp-h1
1398
1399cyassl-install:
1400	@true
1401
1402ifeq ($(RTCONFIG_OPENVPN),y)
1403OPENSSL_CIPHERS:=enable-rc5
1404else
1405#OPENSSL_CIPHERS:=no-dh no-idea no-rc2 no-rc5 no-aes no-aes192 no-cast no-des no-modes no-tls1 no-tlsext
1406OPENSSL_CIPHERS:=
1407endif
1408
1409#OPENSSL_CIPHERS:=enable-aes enable-tls1 enable-tlsext
1410
1411openssl-1.0.0q/Makefile:
1412	cd openssl-1.0.0q && \
1413	./Configure $(HOSTCONFIG) --openssldir=/etc --cross-compile-prefix=' ' \
1414	-ffunction-sections -fdata-sections -Wl,--gc-sections \
1415	shared $(OPENSSL_CIPHERS)
1416#	no-sha0 no-smime no-camellia no-krb5 no-rmd160 no-ripemd \
1417#	no-seed no-capieng no-cms no-gms no-gmp no-rfc3779 \
1418#	no-ec no-ecdh no-ecdsa no-err no-hw no-jpake no-threads \
1419#	no-zlib no-engine no-engines no-sse2 no-perlasm \
1420#	no-dtls1 no-store no-psk no-md2 no-mdc2 no-ts
1421
1422	-@$(MAKE) -C openssl-1.0.0q clean
1423	@touch $@
1424
1425openssl-1.0.0q: openssl-1.0.0q/Makefile
1426	$(MAKE) -C openssl-1.0.0q && $(MAKE) $@-stage
1427
1428openssl-1.0.0q-clean:
1429	[ ! -f openssl-1.0.0q/Makefile ] || $(MAKE) -C openssl-1.0.0q clean
1430	@rm -f openssl-1.0.0q/Makefile
1431
1432openssl-1.0.0q-install: openssl-1.0.0q
1433	install -D openssl-1.0.0q/libcrypto-1.0.0q.so.1.0.0 $(INSTALLDIR)/openssl-1.0.0q/usr/lib/libcrypto-1.0.0q.so.1.0.0
1434	$(STRIP) $(INSTALLDIR)/openssl-1.0.0q/usr/lib/libcrypto-1.0.0q.so.1.0.0
1435	cd $(INSTALLDIR)/openssl-1.0.0q/usr/lib && ln -sf libcrypto-1.0.0q.so.1.0.0 libcrypto-1.0.0q.so
1436
1437#	install -D openssl-1.0.0q/apps/openssl-1.0.0q $(INSTALLDIR)/openssl-1.0.0q/usr/sbin/openssl-1.0.0q
1438#	$(STRIP) $(INSTALLDIR)/openssl-1.0.0q/usr/sbin/openssl-1.0.0q
1439#	chmod 0500 $(INSTALLDIR)/openssl-1.0.0q/usr/sbin/openssl-1.0.0q
1440
1441	install -D openssl-1.0.0q/libssl-1.0.0q.so.1.0.0 $(INSTALLDIR)/openssl-1.0.0q/usr/lib/libssl-1.0.0q.so.1.0.0
1442	$(STRIP) $(INSTALLDIR)/openssl-1.0.0q/usr/lib/libssl-1.0.0q.so.1.0.0
1443	cd $(INSTALLDIR)/openssl-1.0.0q/usr/lib && ln -sf libssl-1.0.0q.so.1.0.0 libssl-1.0.0q.so
1444
1445openssl-1.0.0q-stage:
1446	@$(MAKE) -C openssl-1.0.0q install_sw INSTALL_PREFIX=$(STAGEDIR)
1447
1448openssl/Makefile:
1449	cd openssl && \
1450	./Configure $(HOSTCONFIG) --openssldir=/etc --cross-compile-prefix=' ' \
1451	-ffunction-sections -fdata-sections -Wl,--gc-sections \
1452	shared $(OPENSSL_CIPHERS)
1453#	no-sha0 no-smime no-camellia no-krb5 no-rmd160 no-ripemd \
1454#	no-seed no-capieng no-cms no-gms no-gmp no-rfc3779 \
1455#	no-ec no-ecdh no-ecdsa no-err no-hw no-jpake no-threads \
1456#	no-zlib no-engine no-engines no-sse2 no-perlasm \
1457#	no-dtls1 no-store no-psk no-md2 no-mdc2 no-ts
1458
1459	-@$(MAKE) -C openssl clean
1460	@touch $@
1461
1462openssl: openssl/Makefile
1463	$(MAKE) -C openssl && $(MAKE) $@-stage
1464
1465openssl-clean:
1466	[ ! -f openssl/Makefile ] || $(MAKE) -C openssl clean
1467	@rm -f openssl/Makefile
1468
1469openssl-install: openssl
1470	install -D openssl/libcrypto.so.1.0.0 $(INSTALLDIR)/openssl/usr/lib/libcrypto.so.1.0.0
1471	$(STRIP) $(INSTALLDIR)/openssl/usr/lib/libcrypto.so.1.0.0
1472	cd $(INSTALLDIR)/openssl/usr/lib && ln -sf libcrypto.so.1.0.0 libcrypto.so
1473
1474	install -D openssl/apps/openssl $(INSTALLDIR)/openssl/usr/sbin/openssl
1475	$(STRIP) $(INSTALLDIR)/openssl/usr/sbin/openssl
1476	chmod 0500 $(INSTALLDIR)/openssl/usr/sbin/openssl
1477
1478# add for webdav
1479	install -D openssl/libssl.so.1.0.0 $(INSTALLDIR)/openssl/usr/lib/libssl.so.1.0.0
1480	$(STRIP) $(INSTALLDIR)/openssl/usr/lib/libssl.so.1.0.0
1481	cd $(INSTALLDIR)/openssl/usr/lib && ln -sf libssl.so.1.0.0 libssl.so
1482
1483	install -D -m 0500 httpd/gencert.sh $(INSTALLDIR)/openssl/usr/sbin/gencert.sh
1484
1485#	perl -e 'while (<>) { s/.SECS/time()-(24*60*60)/e; print; }' < httpd/gencert.sh > $(INSTALLDIR)/openssl/usr/sbin/gencert.sh
1486#	chmod 0500 $(INSTALLDIR)/openssl/usr/sbin/gencert.sh
1487
1488ifeq ($(RTCONFIG_FTP_SSL),y)
1489# !!TB
1490	install -D openssl/libssl.so.1.0.0 $(INSTALLDIR)/openssl/usr/lib/libssl.so.1.0.0
1491	$(STRIP) $(INSTALLDIR)/openssl/usr/lib/libssl.so.1.0.0
1492	cd $(INSTALLDIR)/openssl/usr/lib && ln -sf libssl.so.1.0.0 libssl.so
1493endif
1494
1495ifeq ($(RTCONFIG_OPENVPN),y)
1496	install -D openssl/libssl.so.1.0.0 $(INSTALLDIR)/openssl/usr/lib/libssl.so.1.0.0
1497	$(STRIP) $(INSTALLDIR)/openssl/usr/lib/libssl.so.1.0.0
1498	cd $(INSTALLDIR)/openssl/usr/lib && ln -sf libssl.so.1.0.0 libssl.so
1499endif
1500
1501ifeq ($(RTCONFIG_HTTPS),y)
1502	install -D openssl/libssl.so.1.0.0 $(INSTALLDIR)/openssl/usr/lib/libssl.so.1.0.0
1503	$(STRIP) $(INSTALLDIR)/openssl/usr/lib/libssl.so.1.0.0
1504	cd $(INSTALLDIR)/openssl/usr/lib && ln -sf libssl.so.1.0.0 libssl.so
1505endif
1506
1507openssl-stage:
1508	@$(MAKE) -C openssl install_sw INSTALL_PREFIX=$(STAGEDIR)
1509
1510mssl:	openssl
1511
1512mdu:	shared mssl
1513
1514wb: openssl libxml2 curl-7.21.7
1515
1516push_log: wb
1517
1518rc: nvram$(BCMEX) shared libbcmcrypto libdisk $(if $(RTCONFIG_PUSH_EMAIL),push_log) $(if $(RTCONFIG_QTN),libqcsapi_client) $(if $(CONFIG_LIBBCM),libbcm) $(if $(RTCONFIG_BWDPI),bwdpi)
1519
1520networkmap: shared
1521
1522bridge/stamp-h1:
1523	cd bridge && CFLAGS="-Os -g $(EXTRACFLAGS)" \
1524	$(CONFIGURE) --prefix="" --with-linux-headers=$(LINUXDIR)/include
1525	touch $@
1526
1527bridge: bridge/stamp-h1
1528	@$(SEP)
1529	@$(MAKE) -C bridge
1530
1531bridge-clean:
1532	-@$(MAKE) -C bridge clean
1533	@rm -f bridge/stamp-h1
1534
1535bridge-install:
1536	install -D bridge/brctl/brctl $(INSTALLDIR)/bridge/usr/sbin/brctl
1537	$(STRIP) $(INSTALLDIR)/bridge/usr/sbin/brctl
1538
1539rstpd:
1540	$(MAKE) -C rstpd
1541
1542rstpd-clean:
1543	$(MAKE) -C rstpd clean
1544
1545rstpd-install:
1546	install -D rstpd/rstpd $(INSTALLDIR)/rstpd/usr/sbin/rstpd
1547	$(STRIP) $(INSTALLDIR)/rstpd/usr/sbin/rstpd
1548
1549dmalloc: dmalloc/Makefile dmalloc/dmalloc.h.2 dmalloc/settings.h
1550	$(MAKE) -C dmalloc all shlib cxx && $(MAKE) $@-stage
1551
1552dmalloc/Makefile dmalloc/dmalloc.h.2 dmalloc/settings.h:
1553	$(MAKE) dmalloc-configure
1554
1555dmalloc-configure:
1556	( cd dmalloc ; \
1557		$(CONFIGURE) \
1558		--prefix=/usr \
1559		--bindir=/usr/sbin \
1560		--libdir=/usr/lib \
1561		--enable-cxx --enable-threads --enable-shlib --with-pagesize=12 \
1562	)
1563
1564dmalloc-install: dmalloc
1565	install -D $(STAGEDIR)/usr/sbin/dmalloc $(INSTALLDIR)/dmalloc/usr/sbin/dmalloc
1566	install -d $(INSTALLDIR)/dmalloc/usr/lib
1567	install -D $(STAGEDIR)/usr/lib/libdmalloc*.so* $(INSTALLDIR)/dmalloc/usr/lib
1568	$(STRIP) $(INSTALLDIR)/dmalloc/usr/sbin/dmalloc
1569	$(STRIP) $(INSTALLDIR)/dmalloc/usr/lib/*.so*
1570
1571dmalloc-clean:
1572	[ ! -f dmalloc/Makefile ] || $(MAKE) -C dmalloc clean
1573	@rm -f dmalloc/{conf.h,dmalloc.h,dmalloc.h.2,settings.h,Makefile}
1574
1575ifeq ($(RTCONFIG_BCM7),y)
1576$(obj-pciefd) :
1577# Build PCIEFD firmware only if it is not prebuilt
1578ifeq ($(RTCONFIG_DHDAP),y)
1579ifneq ($(wildcard $(SRCBASE_FW)/wl/sys),)
1580	+$(MAKE) CROSS_COMPILE=arm-none-eabi -C $(SRCBASE_FW)/dongle/rte/wl $(patsubst %-obj,%,$@)/$(PCIEFD_TARGET_NAME)
1581	if [ -f $(SRCBASE_FW)/dongle/rte/wl/builds/$(patsubst %-obj,%,$@)/$(PCIEFD_TARGET_NAME)/rtecdc_$(patsubst %-roml-obj,%,$@).h ]; then \
1582		cp $(SRCBASE_FW)/dongle/rte/wl/builds/$(patsubst %-obj,%,$@)/$(PCIEFD_TARGET_NAME)/rtecdc_$(patsubst %-roml-obj,%,$@).h $(SRCBASE_DHD)/shared/rtecdc_$(patsubst %-roml-obj,%,$@).h && \
1583		echo "#include <rtecdc_$(patsubst %-roml-obj,%,$@).h>" >> $(PCIEFD_EMBED_HEADER); \
1584	fi;
1585	if [ -f $(SRCBASE_FW)/dongle/rte/wl/builds/$(patsubst %-obj,%,$@)/$(PCIEFD_TARGET_NAME)/rtecdc_$(patsubst %-ram-obj,%,$@).h ]; then \
1586		cp $(SRCBASE_FW)/dongle/rte/wl/builds/$(patsubst %-obj,%,$@)/$(PCIEFD_TARGET_NAME)/rtecdc_$(patsubst %-ram-obj,%,$@).h $(SRCBASE_DHD)/shared/rtecdc_$(patsubst %-ram-obj,%,$@).h && \
1587		echo "#include <rtecdc_$(patsubst %-ram-obj,%,$@).h>" >> $(PCIEFD_EMBED_HEADER); \
1588	fi;
1589	if [ -f $(SRCBASE_FW)/dongle/rte/wl/builds/$(patsubst %-obj,%,$@)/$(PCIEFD_TARGET_NAME)/wlc_clm_data.c ]; then \
1590		cp $(SRCBASE_FW)/dongle/rte/wl/builds/$(patsubst %-obj,%,$@)/$(PCIEFD_TARGET_NAME)/wlc_clm_data.c $(SRCBASE_FW)/wl/clm/src/wlc_clm_data.c.GEN && \
1591		cp $(SRCBASE_FW)/dongle/rte/wl/builds/$(patsubst %-obj,%,$@)/$(PCIEFD_TARGET_NAME)/wlc_clm_data_inc.c $(SRCBASE_FW)/wl/clm/src/wlc_clm_data_inc.c.GEN; \
1592	fi;
1593endif
1594endif
1595
1596pciefd-cleangen: pciefd-clean
1597# Clean PCIEFD firmware only if it is not prebuilt
1598ifeq ($(RTCONFIG_DHDAP),y)
1599ifneq ($(wildcard $(SRCBASE_FW)/wl/sys),)
1600	rm -f  $(PCIEFD_EMBED_HEADER)
1601	cp -f $(PCIEFD_EMBED_HEADER_TEMPLATE) $(PCIEFD_EMBED_HEADER)
1602endif
1603endif
1604
1605pciefd: pciefd-cleangen $(obj-pciefd)
1606
1607pciefd-clean :
1608ifeq ($(RTCONFIG_DHDAP),y)
1609ifneq ($(wildcard $(SRCBASE_FW)/wl/sys),)
1610	+$(MAKE) CROSS_COMPILE=arm-none-eabi -C $(SRCBASE_FW)/dongle/rte/wl clean
1611	rm -f $(SRCBASE_DHD)/shared/rtecdc*.h
1612endif
1613endif
1614
1615pciefd-install :
1616	# Nothing to be done here
1617	@true
1618endif	# BCM7
1619
1620ifeq ($(RTCONFIG_DHDAP),y)
1621dhd:
1622	@true
1623ifneq ($(wildcard $(SRCBASE_DHD)/dhd/exe),)
1624	$(MAKE) TARGET_PREFIX=$(CROSS_COMPILE) -C $(SRCBASE_DHD)/dhd/exe
1625endif
1626
1627dhd-clean :
1628ifneq ($(wildcard $(SRCBASE_DHD)/dhd/exe),)
1629	$(MAKE) TARGET_PREFIX=$(CROSS_COMPILE) -C $(SRCBASE_DHD)/dhd/exe clean
1630	rm -f $(INSTALLDIR)/dhd/usr/sbin/dhd
1631	cd $(SRCBASE_DHD) && rm -f `find ./ -name "*.cmd" && find ./ -name "*.o"`
1632endif
1633
1634dhd-install :
1635ifneq ($(wildcard $(SRCBASE_DHD)/dhd/exe),)
1636	install -d $(INSTALLDIR)/dhd/usr/sbin
1637	install $(SRCBASE_DHD)/dhd/exe/dhd $(INSTALLDIR)/dhd/usr/sbin
1638	$(STRIP) $(INSTALLDIR)/dhd/usr/sbin/dhd
1639endif
1640endif
1641
1642.PHONY: dhd_monitor
1643
1644dhd_monitor: shared nvram$(BCMEX)
1645ifeq ($(RTCONFIG_DHDAP),y)
1646	+$(MAKE) LINUXDIR=$(LINUXDIR) EXTRA_LDFLAGS=$(EXTRA_LDFLAGS) -C dhd_monitor dhd_monitor
1647endif
1648
1649dhd_monitor-install: dhd_monitor
1650ifeq ($(RTCONFIG_DHDAP),y)
1651	+$(MAKE) -C dhd_monitor INSTALLDIR=$(INSTALLDIR)/dhd_monitor install
1652endif
1653
1654dhd_monitor-clean:
1655ifeq ($(RTCONFIG_DHDAP),y)
1656	+$(MAKE) -C dhd_monitor clean
1657endif
1658
1659
1660dnsmasq:
1661	@$(SEP)
1662	@$(MAKE) -C dnsmasq \
1663	COPTS="-DHAVE_BROKEN_RTC -DHAVE_LEASEFILE_EXPIRE -DNO_AUTH -DNO_IPSET -DNO_LOOP -DNO_INOTIFY \
1664		$(if $(RTCONFIG_IPV6),-DUSE_IPV6,-DNO_IPV6) \
1665		$(if $(RTCONFIG_USB_EXTRAS)||$(RTCONFIG_TR069),,-DNO_SCRIPT) \
1666		$(if $(RTCONFIG_USB_EXTRAS),,-DNO_TFTP)" \
1667	CFLAGS="-Os -ffunction-sections -fdata-sections $(EXTRACFLAGS)" \
1668	LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections"
1669
1670dnsmasq-install:
1671	install -D dnsmasq/src/dnsmasq $(INSTALLDIR)/dnsmasq/usr/sbin/dnsmasq
1672	$(STRIP) $(INSTALLDIR)/dnsmasq/usr/sbin/dnsmasq
1673
1674iptables:
1675	@$(SEP)
1676	$(MAKE) -C iptables BINDIR=/usr/sbin LIBDIR=/usr/lib KERNEL_DIR=$(LINUXDIR) COPT_FLAGS="-Os $(EXTRACFLAGS) -U CONFIG_NVRAM_SIZE"
1677
1678iptables-install:
1679	install -D iptables/iptables $(INSTALLDIR)/iptables/usr/sbin/iptables
1680	cd $(INSTALLDIR)/iptables/usr/sbin && \
1681		ln -sf iptables iptables-save && \
1682		ln -sf iptables iptables-restore
1683
1684	install -d $(INSTALLDIR)/iptables/usr/lib/iptables
1685	install -D iptables/extensions/*.so $(INSTALLDIR)/iptables/usr/lib/iptables/
1686
1687	install -D iptables/libiptc.so $(INSTALLDIR)/iptables/usr/lib/libiptc.so
1688
1689	$(STRIP) $(INSTALLDIR)/iptables/usr/sbin/iptables
1690	$(STRIP) $(INSTALLDIR)/iptables/usr/lib/iptables/*.so
1691	$(STRIP) $(INSTALLDIR)/iptables/usr/lib/libiptc.so
1692
1693ifeq ($(RTCONFIG_IPV6),y)
1694	install iptables/ip6tables $(INSTALLDIR)/iptables/usr/sbin/ip6tables
1695	$(STRIP) $(INSTALLDIR)/iptables/usr/sbin/ip6tables
1696	cd $(INSTALLDIR)/iptables/usr/sbin && \
1697		ln -sf ip6tables ip6tables-save && \
1698		ln -sf ip6tables ip6tables-restore
1699endif
1700
1701iptables-clean:
1702	-@$(MAKE) -C iptables KERNEL_DIR=$(LINUXDIR) clean
1703
1704iptables-1.4.x/configure:
1705	cd iptables-1.4.x && ./autogen.sh
1706
1707iptables-1.4.x/Makefile: iptables-1.4.x/configure
1708	cd iptables-1.4.x && $(CONFIGURE) \
1709		--prefix=/usr \
1710		--bindir=/usr/sbin \
1711		--libdir=/usr/lib \
1712		--with-kernel=$(LINUXDIR) \
1713		$(if $(RTCONFIG_IPV6),--enable-ipv6,--disable-ipv6) \
1714		CFLAGS="-Os $(EXTRACFLAGS) -U CONFIG_NVRAM_SIZE"
1715
1716iptables-1.4.x: iptables-1.4.x/Makefile
1717	@$(SEP)
1718	$(MAKE) -C $@ KERNEL_DIR=$(LINUXDIR) COPT_FLAGS="-Os $(EXTRACFLAGS) -U CONFIG_NVRAM_SIZE"
1719
1720iptables-1.4.x-install: iptables-1.4.x
1721	install -D iptables-1.4.x/iptables/.libs/xtables-multi $(INSTALLDIR)/iptables-1.4.x/usr/sbin/xtables-multi
1722	cd $(INSTALLDIR)/iptables-1.4.x/usr/sbin && \
1723		ln -sf xtables-multi iptables-restore && \
1724		ln -sf xtables-multi iptables-save && \
1725		ln -sf xtables-multi iptables
1726	install -d $(INSTALLDIR)/iptables-1.4.x/usr/lib/xtables
1727	install -D iptables-1.4.x/libiptc/.libs/libiptc.so $(INSTALLDIR)/iptables-1.4.x/usr/lib/libiptc.so
1728	install -D iptables-1.4.x/libiptc/.libs/libip4tc.so $(INSTALLDIR)/iptables-1.4.x/usr/lib/libip4tc.so
1729	cd $(INSTALLDIR)/iptables-1.4.x/usr/lib && \
1730		ln -sf libiptc.so  libiptc.so.0 && \
1731		ln -sf libiptc.so  libiptc.so.0.0.0 && \
1732		ln -sf libip4tc.so libip4tc.so.0 && \
1733		ln -sf libip4tc.so libip4tc.so.0.0.0
1734	install -D iptables-1.4.x/iptables/.libs/lib*.so $(INSTALLDIR)/iptables-1.4.x/usr/lib/
1735	cd $(INSTALLDIR)/iptables-1.4.x/usr/lib && \
1736		ln -sf libxtables.so libxtables.so.7 && \
1737		ln -sf libxtables.so libxtables.so.7.0.0
1738	install -D iptables-1.4.x/extensions/*.so $(INSTALLDIR)/iptables-1.4.x/usr/lib/xtables
1739
1740ifeq ($(RTCONFIG_IPV6),y)
1741	cd $(INSTALLDIR)/iptables-1.4.x/usr/sbin && \
1742		ln -sf xtables-multi ip6tables-restore && \
1743		ln -sf xtables-multi ip6tables
1744	install -D iptables-1.4.x/libiptc/.libs/libip6tc.so $(INSTALLDIR)/iptables-1.4.x/usr/lib/libip6tc.so
1745	cd $(INSTALLDIR)/iptables-1.4.x/usr/lib && \
1746		ln -sf libip6tc.so libip6tc.so.0 && \
1747		ln -sf libip6tc.so libip6tc.so.0.0.0
1748endif
1749
1750	$(STRIP) $(INSTALLDIR)/iptables-1.4.x/usr/sbin/xtables-multi
1751	$(STRIP) $(INSTALLDIR)/iptables-1.4.x/usr/lib/*.so*
1752	$(STRIP) $(INSTALLDIR)/iptables-1.4.x/usr/lib/xtables/*.so*
1753
1754iptables-1.4.x-clean:
1755	[ ! -f iptables-1.4.x/Makefile ] || $(MAKE) -C iptables-1.4.x KERNEL_DIR=$(LINUXDIR) distclean
1756	@rm -f iptables-1.4.x/Makefile
1757
1758upnp: nvram$(BCMEX) shared $(IPTABLES)
1759
1760miniupnpd/config.h: shared/version.h
1761	cd miniupnpd && ./genconfig.sh --vendorcfg --leasefile
1762
1763miniupnpd: $(IPTABLES) miniupnpd/config.h
1764	@$(SEP)
1765	PKG_CONFIG=false ARCH=$(PLATFORM) \
1766	$(MAKE) -C $@ -f Makefile.asus \
1767	    IPTABLESPATH=$(TOP)/$(IPTABLES) \
1768	    EXTRACFLAGS="-Os $(EXTRACFLAGS) -idirafter$(KERNEL_HEADER_DIR) -ffunction-sections -fdata-sections" \
1769	    LDFLAGS="$(EXTRALDFLAGS) -ffunction-sections -fdata-sections -Wl,--gc-sections -L$(IPTC_LIBDIR)" \
1770	    LDLIBS="-Wl,--as-needed $(IPTC_LIBS)"
1771
1772miniupnpd-clean:
1773	-@$(MAKE) -C miniupnpd -f Makefile.asus clean
1774	-@rm miniupnpd/config.h
1775
1776miniupnpd_1.4: $(IPTABLES) shared/version.h
1777	@$(SEP)
1778	cp -f shared/version.h $@/
1779	$(MAKE) -C $@ -f Makefile.asus \
1780	    IPTABLESPATH=$(TOP)/$(IPTABLES) \
1781	    EXTRACFLAGS="-Os $(EXTRACFLAGS) -ffunction-sections -fdata-sections" \
1782	    LDFLAGS="$(EXTRALDFLAGS) -ffunction-sections -fdata-sections -Wl,--gc-sections -L$(IPTC_LIBDIR)" \
1783	    LDLIBS="-Wl,--as-needed $(IPTC_LIBS)"
1784
1785miniupnpd_1.4-clean:
1786	-@$(MAKE) -C miniupnpd_1.4 -f Makefile.asus clean
1787
1788miniupnpd$(MUVER)-install: miniupnpd$(MUVER)
1789	install -D miniupnpd$(MUVER)/miniupnpd $(INSTALLDIR)/miniupnpd$(MUVER)/usr/sbin/miniupnpd
1790	$(STRIP) $(INSTALLDIR)/miniupnpd$(MUVER)/usr/sbin/miniupnpd
1791
1792miniupnpc:
1793	$(MAKE) -C miniupnpc
1794
1795miniupnpc-clean:
1796	-@$(MAKE) -C miniupnpc clean
1797
1798miniupnpc-install:
1799	install -D miniupnpc/upnpc-static $(INSTALLDIR)/miniupnpc/usr/sbin/miniupnpc
1800	$(STRIP) $(INSTALLDIR)/miniupnpc/usr/sbin/miniupnpc
1801
1802# !!TB
1803shared: busybox $(if $(RTCONFIG_QTN),libqcsapi_client) $(if $(RTCONFIG_HTTPS),openssl)
1804ifeq ($(RTCONFIG_RALINK)$(RTCONFIG_QCA),y)
1805	make -C wireless_tools wireless.h	
1806endif
1807	$(MAKE) -C shared
1808
1809ifeq ($(RTCONFIG_FTP_SSL),y)
1810ftp_dep=openssl
1811else
1812ftp_dep=
1813endif
1814vsftpd: $(ftp_dep)
1815	@$(SEP)
1816	$(MAKE) -C vsftpd
1817
1818vsftpd-install: vsftpd
1819	install -D vsftpd/vsftpd $(INSTALLDIR)/vsftpd/usr/sbin/vsftpd
1820	$(STRIP) -s $(INSTALLDIR)/vsftpd/usr/sbin/vsftpd
1821
1822vsftpd-3.x: $(ftp_dep)
1823	@$(SEP)
1824	$(MAKE) -C $@
1825
1826vsftpd-3.x-install: vsftpd-3.x
1827	install -D vsftpd-3.x/vsftpd $(INSTALLDIR)/vsftpd-3.x/usr/sbin/vsftpd
1828	$(STRIP) -s $(INSTALLDIR)/vsftpd-3.x/usr/sbin/vsftpd
1829
1830ntfs-3g/stamp-h1:
1831	cd ntfs-3g && \
1832	CC=$(CC) CFLAGS="-Os -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections" \
1833		LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections -fPIC -ldl" \
1834		$(CONFIGURE) --enable-shared=no --enable-static=no \
1835		--disable-library --disable-ldconfig --disable-mount-helper --with-fuse=internal \
1836		--disable-posix-acls --disable-nfconv --disable-dependency-tracking
1837	touch $@
1838
1839ntfs-3g: ntfs-3g/stamp-h1
1840	@$(MAKE) -C ntfs-3g
1841
1842ntfs-3g-clean:
1843	-@$(MAKE) -C ntfs-3g clean
1844	@rm -f ntfs-3g/stamp-h1
1845
1846ntfs-3g-install: ntfs-3g
1847	install -D ntfs-3g/src/ntfs-3g $(INSTALLDIR)/ntfs-3g/bin/ntfs-3g
1848	$(STRIP) -s $(INSTALLDIR)/ntfs-3g/bin/ntfs-3g
1849	install -d $(INSTALLDIR)/ntfs-3g/sbin && cd $(INSTALLDIR)/ntfs-3g/sbin && \
1850		ln -sf ../bin/ntfs-3g mount.ntfs-3g && \
1851		ln -sf ../bin/ntfs-3g mount.ntfs
1852
1853linux-ntfs-2.0.0/stamp-h1:
1854	cd linux-ntfs-2.0.0 && \
1855	$(CONFIGURE)
1856	touch $@
1857
1858linux-ntfs-2.0.0: linux-ntfs-2.0.0/stamp-h1
1859	@$(MAKE) -C linux-ntfs-2.0.0 all
1860
1861linux-ntfs-2.0.0-install:
1862	install -D linux-ntfs-2.0.0/libntfs/.libs/libntfs.so.10.0.0 $(INSTALLDIR)/linux-ntfs-2.0.0/usr/lib/libntfs.so.10.0.0
1863	$(STRIP) $(INSTALLDIR)/linux-ntfs-2.0.0/usr/lib/libntfs.so.10.0.0
1864	cd $(INSTALLDIR)/linux-ntfs-2.0.0/usr/lib && \
1865		ln -sf libntfs.so.10.0.0 libntfs.so.10 && \
1866		ln -sf libntfs.so.10.0.0 libntfs.so
1867	install -D linux-ntfs-2.0.0/ntfsprogs/.libs/ntfsfix $(INSTALLDIR)/linux-ntfs-2.0.0/usr/sbin/ntfsfix
1868	$(STRIP) $(INSTALLDIR)/linux-ntfs-2.0.0/usr/sbin/*
1869
1870linux-ntfs-2.0.0-clean:
1871	-@$(MAKE) -C linux-ntfs-2.0.0 clean
1872	@rm -f linux-ntfs-2.0.0/stamp-h1
1873
1874libupnp-1.3.1: libupnp-1.3.1/Makefile
1875	$(MAKE) -C $@
1876
1877libupnp-1.3.1-install: libupnp-1.3.1
1878	@echo "do nothing"
1879#	install -d $(INSTALLDIR)/libupnp-1.3.1/usr/lib
1880#	install -m 775 libupnp-1.3.1/ixml/.libs/libixml.so.2.0.0 $(INSTALLDIR)/libupnp-1.3.1/usr/lib/libixml.so.2.0.0
1881#	install -m 775 libupnp-1.3.1/threadutil/.libs/libthreadutil.so.2.0.0 $(INSTALLDIR)/libupnp-1.3.1/usr/lib/libthreadutil.so.2.0.0
1882#	install -m 775 libupnp-1.3.1/upnp/.libs/libupnp.so.2.0.1 $(INSTALLDIR)/libupnp-1.3.1/usr/lib/libupnp.so.2.0.1
1883#	$(STRIP) $(INSTALLDIR)/libupnp-1.3.1/usr/lib/*.so.*
1884#	cd $(INSTALLDIR)/libupnp-1.3.1/usr/lib && \
1885#		ln -sf libixml.so.2.0.0 libixml.so.2 && \
1886#		ln -sf libixml.so.2.0.0 libixml.so
1887#	cd $(INSTALLDIR)/libupnp-1.3.1/usr/lib && \
1888#		ln -sf libthreadutil.so.2.0.0 libthreadutil.so.2 && \
1889#		ln -sf libthreadutil.so.2.0.0 libthreadutil.so
1890#	cd $(INSTALLDIR)/libupnp-1.3.1/usr/lib && \
1891#		ln -sf libupnp.so.2.0.1 libupnp.so.2 && \
1892#		ln -sf libupnp.so.2.0.1 libupnp.so
1893
1894libupnp-1.3.1/Makefile: libupnp-1.3.1/Makefile.in
1895	( cd libupnp-1.3.1; \
1896	  config.aux/missing aclocal; \
1897	  config.aux/missing automake; \
1898	  config.aux/missing autoconf; \
1899	  $(CONFIGURE) --prefix=/usr --disable-dependency-tracking \
1900	 )
1901
1902libusb10/stamp-h1:
1903	cd libusb10 && CFLAGS="-Os -Wall $(EXTRACFLAGS)" LIBS="-lpthread -ldl" \
1904	$(CONFIGURE) --prefix=/usr ac_cv_lib_rt_clock_gettime=no
1905	-@$(MAKE) -C libusb10 clean
1906	touch $@
1907
1908libusb10: libusb10/stamp-h1
1909	$(MAKE) -C $@
1910
1911libusb10-install: libusb10
1912	install -D libusb10/libusb/.libs/libusb-1.0.so.0.0.0 $(INSTALLDIR)/libusb10/usr/lib/libusb-1.0.so.0
1913	$(STRIP) $(INSTALLDIR)/libusb10/usr/lib/*.so.*
1914	cd $(INSTALLDIR)/libusb10/usr/lib && \
1915		ln -sf libusb-1.0.so.0 libusb-1.0.so.0.0.0 && \
1916		ln -sf libusb-1.0.so.0 libusb-1.0.so
1917
1918libusb10-clean:
1919	-@$(MAKE) -C libusb10 clean
1920	@rm -f libusb10/stamp-h1
1921
1922libusb/stamp-h1:
1923	cd libusb && CFLAGS="-Wall -Os $(EXTRACFLAGS)" \
1924	$(CONFIGURE) --prefix=/usr \
1925		LIBUSB_1_0_CFLAGS="-I$(TOP)/libusb10/libusb" \
1926		LIBUSB_1_0_LIBS="-L$(TOP)/libusb10/libusb/.libs -lusb-1.0 -lpthread -ldl\
1927		-Wl,-R/lib:/usr/lib:/opt/usr/lib:/usr/local/share"
1928	-@$(MAKE) -C libusb clean
1929	touch $@
1930
1931libusb: libusb10 libusb/stamp-h1
1932	$(MAKE) -C $@
1933
1934libusb-install: libusb
1935	install -D libusb/libusb/.libs/libusb-0.1.so.4.4.4 $(INSTALLDIR)/libusb/usr/lib/libusb-0.1.so.4
1936	$(STRIP) $(INSTALLDIR)/libusb/usr/lib/*.so.*
1937	cd $(INSTALLDIR)/libusb/usr/lib && \
1938		ln -sf libusb-0.1.so.4 libusb-0.1.so.4.4.4 && \
1939		ln -sf libusb-0.1.so.4 libusb.so
1940
1941libusb-clean:
1942	-@$(MAKE) -C libusb clean
1943	@rm -f libusb/stamp-h1
1944
1945#usbmodeswitch: libusb10
1946#	$(MAKE) -C $@ CC=$(CC) CFLAGS="-Os $(EXTRACFLAGS) -DLIBUSB10 \
1947#		-Wl,-R/lib:/usr/lib:/opt/usr/lib:/usr/local/share -lpthread \
1948#		-I$(TOP)/libusb10/libusb -L$(TOP)/libusb10/libusb/.libs -lusb-1.0"
1949
1950usbmodeswitch: libusb-0.1.12
1951	$(MAKE) -C $@ CC=$(CC) CFLAGS="-Os $(EXTRACFLAGS) \
1952		-Wl,-R/lib:/usr/lib:/opt/usr/lib:/usr/local/share -lpthread -ldl\
1953		-I$(TOP)/libusb-0.1.12 -L$(TOP)/libusb-0.1.12/.libs -lusb"
1954
1955usbmodeswitch-install: usbmodeswitch usbmodeswitch-install
1956	install -D usbmodeswitch/usb_modeswitch $(INSTALLDIR)/usbmodeswitch/usr/sbin/usb_modeswitch
1957	$(STRIP) -s $(INSTALLDIR)/usbmodeswitch/usr/sbin/usb_modeswitch
1958	@mkdir -p $(TARGETDIR)/rom/etc
1959	@sed 's/#.*//g;s/[ \t]\+/ /g;s/^[ \t]*//;s/[ \t]*$$//;/^$$/d' < $(TOP)/usbmodeswitch/usb_modeswitch.conf > $(TARGETDIR)/rom/etc/usb_modeswitch.conf
1960
1961usbmodeswitch-1.2.3: libusb-0.1.12
1962	$(MAKE) -C $@ CC=$(CC) CFLAGS="-Os $(EXTRACFLAGS) \
1963		-Wl,-R/lib:/usr/lib:/opt/usr/lib:/usr/local/share -lpthread -ldl\
1964		-I$(TOP)/libusb-0.1.12 -L$(TOP)/libusb-0.1.12/.libs -lusb"
1965
1966usbmodeswitch-1.2.3-install: usbmodeswitch-1.2.3
1967	install -D usbmodeswitch-1.2.3/usb_modeswitch $(INSTALLDIR)/usbmodeswitch-1.2.3/usr/sbin/usb_modeswitch
1968	$(STRIP) -s $(INSTALLDIR)/usbmodeswitch-1.2.3/usr/sbin/usb_modeswitch
1969	@mkdir -p $(TARGETDIR)/rom/etc
1970	@sed 's/#.*//g;s/[ \t]\+/ /g;s/^[ \t]*//;s/[ \t]*$$//;/^$$/d' < $(TOP)/usbmodeswitch-1.2.3/usb_modeswitch.conf > $(TARGETDIR)/rom/etc/usb_modeswitch.conf
1971
1972usb-modeswitch-2.2.0: libusb10
1973	$(MAKE) -C $@ CC=$(CC) CFLAGS="-Os $(EXTRACFLAGS) \
1974		-Wl,-R/lib:/usr/lib:/opt/usr/lib:/usr/local/share -lpthread -ldl\
1975		-I$(TOP)/libusb10/libusb -L$(TOP)/libusb10/libusb/.libs -lusb-1.0"
1976
1977usb-modeswitch-2.2.0-install: usb-modeswitch-2.2.0
1978	install -D usb-modeswitch-2.2.0/usb_modeswitch $(INSTALLDIR)/usb-modeswitch-2.2.0/usr/sbin/usb_modeswitch
1979	$(STRIP) -s $(INSTALLDIR)/usb-modeswitch-2.2.0/usr/sbin/usb_modeswitch
1980	@mkdir -p $(TARGETDIR)/rom/etc
1981	@sed 's/#.*//g;s/[ \t]\+/ /g;s/^[ \t]*//;s/[ \t]*$$//;/^$$/d' < $(TOP)/usb-modeswitch-2.2.0/usb_modeswitch.conf > $(TARGETDIR)/rom/etc/usb_modeswitch.conf
1982
1983usb-modeswitch-2.2.3: libusb10
1984	$(MAKE) -C $@ CC=$(CC) CFLAGS="-Os $(EXTRACFLAGS) \
1985		-Wl,-R/lib:/usr/lib:/opt/usr/lib:/usr/local/share -lpthread -ldl\
1986		-I$(TOP)/libusb10/libusb -L$(TOP)/libusb10/libusb/.libs -lusb-1.0"
1987
1988usb-modeswitch-2.2.3-install: usb-modeswitch-2.2.3
1989	install -D usb-modeswitch-2.2.3/usb_modeswitch $(INSTALLDIR)/usb-modeswitch-2.2.3/usr/sbin/usb_modeswitch
1990	$(STRIP) -s $(INSTALLDIR)/usb-modeswitch-2.2.3/usr/sbin/usb_modeswitch
1991	@mkdir -p $(TARGETDIR)/rom/etc
1992	@sed 's/#.*//g;s/[ \t]\+/ /g;s/^[ \t]*//;s/[ \t]*$$//;/^$$/d' < $(TOP)/usb-modeswitch-2.2.3/usb_modeswitch.conf > $(TARGETDIR)/rom/etc/usb_modeswitch.conf
1993
1994libusb-0.1.12/stamp-h1:
1995	cd libusb-0.1.12 && CFLAGS="-Os -Wall $(EXTRACFLAGS)" LIBS="-lpthread -ldl" \
1996	$(CONFIGURE) --prefix=/usr --disable-build-docs --disable-dependency-tracking
1997	-@$(MAKE) -C libusb-0.1.12 clean
1998	touch $@
1999
2000libusb-0.1.12: libusb-0.1.12/stamp-h1
2001	$(MAKE) -C $@
2002
2003libusb-0.1.12-install: libusb-0.1.12
2004#	install -D libusb-0.1.12/.libs/libusb-0.1.so.4.4.4 $(INSTALLDIR)/libusb-0.1.12/usr/lib/libusb-0.1.so.4.4.4
2005#	$(STRIP) $(INSTALLDIR)/libusb-0.1.12/usr/lib/*.so.*
2006#	cd $(INSTALLDIR)/libusb-0.1.12/usr/lib && \
2007#	ln -sf libusb-0.1.so.4.4.4 libusb-0.1.so.4 && \
2008#	ln -sf libusb-0.1.so.4.4.4 libusb.so
2009	@echo "do nothing"
2010
2011libusb-0.1.12-clean:
2012	-@$(MAKE) -C libusb-0.1.12 clean
2013	@rm -f libusb-0.1.12/stamp-h1
2014
2015libdaemon/stamp-h1:
2016	cd libdaemon && $(CONFIGURE) ac_cv_func_setpgrp_void=yes \
2017	--disable-dependency-tracking
2018	touch $@
2019
2020libdaemon: libdaemon/stamp-h1
2021	$(MAKE) -C $@ && $(MAKE) $@-stage
2022
2023libdaemon-install: libdaemon
2024	install -D libdaemon/libdaemon/.libs/libdaemon.so.0.5.0 $(INSTALLDIR)/libdaemon/usr/lib/libdaemon.so.0.5.0
2025	$(STRIP) $(INSTALLDIR)/libdaemon/usr/lib/*.so.*
2026	cd $(INSTALLDIR)/libdaemon/usr/lib && \
2027		ln -sf libdaemon.so.0.5.0 libdaemon.so && \
2028		ln -sf libdaemon.so.0.5.0 libdaemon.so.0
2029
2030libdaemon-clean:
2031	-@$(MAKE) -C libdaemon distclean
2032	@rm -f libdaemon/stamp-h1
2033
2034lsof: lsof/Makefile
2035	@$(SEP)
2036	$(MAKE) -C $@
2037
2038lsof/Makefile:
2039	( cd lsof ; \
2040		LSOF_CC=$(CC) \
2041		LSOF_INCLUDE=$(TOOLCHAIN)/include \
2042		LSOF_VSTR="asuswrt" \
2043		./Configure -n linux \
2044	)
2045
2046lsof-install:
2047	install -D lsof/lsof $(INSTALLDIR)/lsof/usr/sbin/lsof
2048	$(STRIP) $(INSTALLDIR)/lsof/usr/sbin/lsof
2049
2050lsof-clean:
2051	( cd lsof ; ./Configure -clean )
2052	@rm -f lsof/Makefile
2053
2054mtd-utils: util-linux lzo zlib
2055	$(MAKE) CPPFLAGS="-I$(STAGEDIR)/usr/include" \
2056		CFLAGS="-I$(TOP)/mtd-utils/include  -I$(TOP)/mtd-utils/ubi-utils/include" \
2057		LDFLAGS="-L$(STAGEDIR)/usr/lib" \
2058		WITHOUT_XATTR=1 -C $@
2059
2060mtd-utils-install:
2061	$(MAKE) WITHOUT_XATTR=1 WITHOUT_LZO=1 DESTDIR=$(INSTALLDIR)/mtd-utils -C mtd-utils install
2062
2063mtd-utils-clean:
2064	$(MAKE) -C mtd-utils clean
2065
2066util-linux: util-linux/Makefile
2067	$(MAKE) -C $@/libuuid/src && $(MAKE) $@-stage
2068
2069util-linux/Makefile: util-linux/configure
2070	$(MAKE) util-linux-configure
2071
2072util-linux/configure:
2073	( cd util-linux ; ./autogen.sh )
2074
2075util-linux-configure:
2076	( export scanf_cv_alloc_modifier=no; \
2077		cd util-linux ; \
2078		$(CONFIGURE) \
2079		--prefix=/usr \
2080		--bindir=/usr/sbin \
2081		--libdir=/usr/lib \
2082		--enable-libuuid \
2083		--disable-nls --disable-tls --disable-libblkid --disable-mount --disable-libmount \
2084		--disable-fsck --disable-cramfs --disable-partx --disable-uuidd --disable-mountpoint \
2085		--disable-fallocate --disable-unshare --disable-agetty \
2086		--disable-cramfs --disable-switch_root --disable-pivot_root \
2087		--disable-kill --disable-rename --disable-chsh-only-listed \
2088		--disable-schedutils --disable-wall --disable-pg-bell --disable-require-password \
2089		--disable-use-tty-group --disable-makeinstall-chown --disable-makeinstall-setuid\
2090		--without-ncurses --without-selinux --without-audit \
2091	)
2092
2093util-linux-stage:
2094	$(MAKE) -C util-linux/libuuid/src DESTDIR=$(STAGEDIR) \
2095		install-usrlib_execLTLIBRARIES install-uuidincHEADERS
2096
2097util-linux-install: util-linux
2098	install -D $(STAGEDIR)/usr/lib/libuuid.so.1 $(INSTALLDIR)/util-linux/usr/lib/libuuid.so.1
2099	$(STRIP) $(INSTALLDIR)/util-linux/usr/lib/*.so*
2100
2101util-linux-clean:
2102	[ ! -f util-linux/Makefile ] || $(MAKE) -C util-linux distclean
2103	@rm -f util-linux/Makefile
2104
2105odhcp6c: odhcp6c/Makefile
2106	@EXT_CFLAGS="-Os -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections -fPIC" \
2107	EXT_LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections" \
2108	PREFIX="/usr" \
2109	$(MAKE) -C odhcp6c
2110
2111odhcp6c-install: odhcp6c
2112	install -D odhcp6c/src/odhcp6c $(INSTALLDIR)/odhcp6c/usr/sbin/odhcp6c
2113	$(STRIP) $(INSTALLDIR)/odhcp6c/usr/sbin/odhcp6c
2114
2115odhcp6c-clean:
2116	-@$(MAKE) -C odhcp6c clean
2117
21186relayd: 6relayd/Makefile
2119	@EXT_CFLAGS="-Os -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections -fPIC" \
2120	EXT_LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections" \
2121	PREFIX="/usr" \
2122	$(MAKE) -C 6relayd
2123
21246relayd-install: 6relayd
2125	install -D 6relayd/src/6relayd $(INSTALLDIR)/6relayd/usr/sbin/6relayd
2126	$(STRIP) $(INSTALLDIR)/6relayd/usr/sbin/6relayd
2127
21286relayd-clean:
2129	-@$(MAKE) -C 6relayd clean
2130
2131e2fsprogs: e2fsprogs/Makefile
2132	$(MAKE) -C e2fsprogs
2133
2134e2fsprogs/Makefile:
2135	$(MAKE) e2fsprogs-configure
2136
2137e2fsprogs-configure:
2138	( cd e2fsprogs ; \
2139		$(CONFIGURE) \
2140		--prefix=/usr \
2141		--sbindir=/sbin \
2142		--libdir=/usr/lib \
2143		--disable-defrag \
2144	)
2145
2146e2fsprogs-install:
2147	install -D e2fsprogs/e2fsck/e2fsck $(INSTALLDIR)/e2fsprogs/sbin/fsck.ext4
2148	$(STRIP) $(INSTALLDIR)/e2fsprogs/sbin/fsck.ext4
2149
2150e2fsprogs-clean:
2151	[ ! -f e2fsprogs/Makefile ] || $(MAKE) -C e2fsprogs clean
2152	@rm -f e2fsprogs/Makefile
2153
2154ecmh/stamp-h1:
2155	@touch ecmh/src/stamp-h1
2156
2157ecmh: ecmh/stamp-h1
2158	@$(MAKE) -C ecmh CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD)
2159
2160ecmh-clean:
2161	-@$(MAKE) -C ecmh clean
2162	@rm -f ecmh/src/stamp-h1
2163
2164ecmh-install: ecmh
2165	install -D ecmh/src/ecmh $(INSTALLDIR)/ecmh/bin/ecmh
2166	$(STRIP) $(INSTALLDIR)/ecmh/bin/ecmh
2167
2168p910nd:
2169samba:
2170#samba3:
2171#samba-3.5.8:
2172
2173#samba-3.5.8-install:
2174#	install -D samba-3.5.8/source3/bin/libsmbclient.so $(INSTALLDIR)/samba-3.5.8/usr/lib/libsmbclient.so
2175#	$(STRIP) $(INSTALLDIR)/samba-3.5.8/usr/lib/libsmbclient.so
2176
2177nvram$(BCMEX): shared
2178
2179prebuilt: shared
2180
2181vlan:
2182	@$(SEP)
2183	@$(MAKE) -C vlan CROSS=$(CROSS_COMPILE)	# STRIPTOOL=$(STRIP)
2184
2185vlan-install:
2186	$(MAKE) -C vlan CROSS=$(CROSS_COMPILE) INSTALLDIR=$(INSTALLDIR) install	# STRIPTOOL=$(STRIP)
2187	$(STRIP) $(INSTALLDIR)/vlan/usr/sbin/vconfig
2188
2189accel-pptpd: kernel_header pppd accel-pptpd/pptpd-1.3.3/Makefile
2190	@$(MAKE) -C accel-pptpd server
2191
2192accel-pptpd/pptpd-1.3.3/Makefile:
2193	$(MAKE) accel-pptpd-configure
2194
2195accel-pptpd-configure:
2196	( cd accel-pptpd/pptpd-1.3.3 && CFLAGS="$(CFLAGS) -g -O2 $(EXTRACFLAGS) -idirafter $(KDIR)/include" \
2197		$(CONFIGURE) --prefix=/usr --bindir=/usr/sbin --libdir=/usr/lib \
2198			--enable-bcrelay KDIR=$(KDIR) PPPDIR=$(TOP)/pppd \
2199	)
2200
2201accel-pptpd-clean:
2202	[ ! -f accel-pptpd/pptpd-1.3.3/Makefile ] || $(MAKE) -C accel-pptpd distclean
2203	@rm -f accel-pptpd/pptpd-1.3.3/Makefile
2204
2205accel-pptpd-install: accel-pptpd
2206	$(MAKE) -C accel-pptpd server_install
2207
2208pptpd/stamp-h1:
2209	cd $(TOP)/pptpd && $(CONFIGURE) --prefix=$(INSTALLDIR)/pptpd --enable-bcrelay CC=$(CC) STRIP=$(STRIP) AR=$(AR) LD=$(LD) NM=$(NM) RANLIB=$(RANLIB)
2210	touch $@
2211
2212pptpd: pptpd/stamp-h1
2213
2214pptpd-install: pptpd
2215	@echo pptpd
2216	@install -D pptpd/pptpd $(INSTALLDIR)/pptpd/usr/sbin/pptpd
2217	@install -D pptpd/bcrelay $(INSTALLDIR)/pptpd/usr/sbin/bcrelay
2218	@install -D pptpd/pptpctrl $(INSTALLDIR)/pptpd/usr/sbin/pptpctrl
2219	@$(STRIP) $(INSTALLDIR)/pptpd/usr/sbin/pptpd
2220	@$(STRIP) $(INSTALLDIR)/pptpd/usr/sbin/bcrelay
2221	@$(STRIP) $(INSTALLDIR)/pptpd/usr/sbin/pptpctrl
2222
2223pptpd-clean:
2224	-@make -C pptpd clean
2225	@rm -f pptpd/stamp-h1
2226
2227rp-pppoe/src/stamp-h1:
2228	cd rp-pppoe/src && CFLAGS="-g -O2 $(EXTRACFLAGS) -idirafter $(KDIR)/include" \
2229	$(CONFIGURE) --prefix=/usr --enable-plugin=$(TOP)/pppd \
2230	ac_cv_linux_kernel_pppoe=yes rpppoe_cv_pack_bitfields=rev --disable-debugging
2231	touch $@
2232
2233rp-pppoe: pppd rp-pppoe/src/stamp-h1
2234	@$(MAKE) -C rp-pppoe/src pppoe-relay rp-pppoe.so
2235
2236rp-pppoe-clean:
2237	-@$(MAKE) -C rp-pppoe/src clean
2238	@rm -f rp-pppoe/src/stamp-h1
2239
2240rp-pppoe-install: rp-pppoe
2241	install -D rp-pppoe/src/rp-pppoe.so $(INSTALLDIR)/rp-pppoe/usr/lib/pppd/rp-pppoe.so
2242	$(STRIP) $(INSTALLDIR)/rp-pppoe/usr/lib/pppd/*.so
2243	install -D rp-pppoe/src/pppoe-relay $(INSTALLDIR)/rp-pppoe/usr/sbin/pppoe-relay
2244	$(STRIP) $(INSTALLDIR)/rp-pppoe/usr/sbin/pppoe-relay
2245
2246rp-l2tp/stamp-h1: kernel_header
2247	cd rp-l2tp && CFLAGS="-O2 -Wall $(EXTRACFLAGS) -idirafter $(KDIR)/include $(if $(RTCONFIG_VPNC), -DRTCONFIG_VPNC,)" \
2248	$(CONFIGURE) --prefix=/usr --sysconfdir=/tmp
2249	touch $@
2250
2251rp-l2tp: pppd rp-l2tp/stamp-h1
2252	$(MAKE) -C rp-l2tp
2253
2254rp-l2tp-clean:
2255	-@$(MAKE) -C rp-l2tp distclean
2256	@rm -f rp-l2tp/stamp-h1
2257
2258rp-l2tp-install:
2259	install -d $(INSTALLDIR)/rp-l2tp/usr/lib/l2tp
2260	install rp-l2tp/handlers/*.so $(INSTALLDIR)/rp-l2tp/usr/lib/l2tp
2261	$(STRIP) $(INSTALLDIR)/rp-l2tp/usr/lib/l2tp/*.so
2262	install -D rp-l2tp/handlers/l2tp-control $(INSTALLDIR)/rp-l2tp/usr/sbin/l2tp-control
2263	$(STRIP) $(INSTALLDIR)/rp-l2tp/usr/sbin/l2tp-control
2264	install -D rp-l2tp/l2tpd $(INSTALLDIR)/rp-l2tp/usr/sbin/l2tpd
2265	$(STRIP) $(INSTALLDIR)/rp-l2tp/usr/sbin/l2tpd
2266
2267xl2tpd: pppd
2268	CFLAGS="-g $(EXTRACFLAGS)" $(MAKE) -C $@ PREFIX=/usr xl2tpd
2269
2270xl2tpd-install: xl2tpd
2271	install -D xl2tpd/xl2tpd $(INSTALLDIR)/xl2tpd/usr/sbin/xl2tpd
2272	$(STRIP) $(INSTALLDIR)/xl2tpd/usr/sbin/xl2tpd
2273
2274pptp-client-install:
2275	install -D pptp-client/pptp $(INSTALLDIR)/pptp-client/usr/sbin/pptp
2276	$(STRIP) $(INSTALLDIR)/pptp-client/usr/sbin/pptp
2277
2278accel-pptp/stamp-h1: kernel_header $(LINUXDIR)/include/linux/version.h
2279	cd accel-pptp && CFLAGS="-g -O2 $(EXTRACFLAGS) -idirafter $(KDIR)/include $(if $(RTCONFIG_VPNC), -DRTCONFIG_VPNC,)" \
2280	$(CONFIGURE) --prefix=/usr KDIR=$(KDIR) PPPDIR=$(TOP)/pppd
2281	touch $@
2282
2283accel-pptp: pppd accel-pptp/stamp-h1
2284	@$(MAKE) -C accel-pptp
2285
2286accel-pptp-clean:
2287	-@$(MAKE) -C accel-pptp clean
2288	@rm -f accel-pptp/stamp-h1
2289
2290accel-pptp-install: accel-pptp
2291	install -D accel-pptp/src/.libs/pptp.so $(INSTALLDIR)/accel-pptp/usr/lib/pppd/pptp.so
2292	$(STRIP) $(INSTALLDIR)/accel-pptp/usr/lib/pppd/pptp.so
2293
2294pppd/stamp-h1: kernel_header
2295	cd pppd && $(CONFIGURE) --prefix=/usr --sysconfdir=/tmp
2296	touch $@
2297
2298pppd: pppd/stamp-h1
2299	@$(SEP)
2300	@$(MAKE) -C pppd MFLAGS='$(if $(RTCONFIG_IPV6),HAVE_INET6=y,) \
2301	EXTRACFLAGS="$(EXTRACFLAGS) -idirafter $(KDIR)/include $(if $(RTCONFIG_VPNC),-DRTCONFIG_VPNC,)"'
2302
2303pppd-clean:
2304	-@$(MAKE) -C pppd clean
2305	@rm -f pppd/stamp-h1
2306
2307pppd-install: pppd
2308	install -D pppd/pppd/pppd $(INSTALLDIR)/pppd/usr/sbin/pppd
2309	$(STRIP) $(INSTALLDIR)/pppd/usr/sbin/pppd
2310	install -D pppd/chat/chat $(INSTALLDIR)/pppd/usr/sbin/chat
2311	$(STRIP) $(INSTALLDIR)/pppd/usr/sbin/chat
2312ifeq ($(RTCONFIG_L2TP),y)
2313	install -D pppd/pppd/plugins/pppol2tp/pppol2tp.so $(INSTALLDIR)/pppd/usr/lib/pppd/pppol2tp.so
2314	$(STRIP) $(INSTALLDIR)/pppd/usr/lib/pppd/*.so
2315endif
2316
2317ez-ipupdate-install:
2318	install -D ez-ipupdate/ez-ipupdate $(INSTALLDIR)/ez-ipupdate/usr/sbin/ez-ipupdate
2319	$(STRIP) $(INSTALLDIR)/ez-ipupdate/usr/sbin/ez-ipupdate
2320
2321quagga/stamp-h1:
2322	@cd quagga && \
2323	CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD) \
2324	CFLAGS="-Os -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections" \
2325	LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections -fPIC" \
2326	$(CONFIGURE) --disable-ripngd --disable-ospfd --disable-doc --disable-ospfclient \
2327	--disable-ospf6d --disable-bgpd --disable-bgp-announce --disable-babeld \
2328	--disable-isisd
2329	@touch $@
2330
2331quagga: quagga/stamp-h1
2332	@$(MAKE) -C quagga CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD)
2333
2334quagga-clean:
2335	-@$(MAKE) -C quagga clean
2336	@rm -f quagga/stamp-h1
2337
2338quagga-install:
2339	install -d $(INSTALLDIR)/quagga/usr/lib
2340	libtool --mode=install install -c quagga/lib/libzebra.la $(INSTALLDIR)/quagga/usr/lib
2341	libtool --finish $(INSTALLDIR)/quagga/usr/lib
2342	rm -f $(INSTALLDIR)/quagga/usr/lib/libzebra.a
2343	rm -f $(INSTALLDIR)/quagga/usr/lib/libzebra.la
2344	install -d $(INSTALLDIR)/quagga/usr/sbin
2345	install -d $(INSTALLDIR)/quagga/usr/local/etc
2346	libtool --mode=install install -c quagga/zebra/zebra $(INSTALLDIR)/quagga/usr/sbin
2347	install -c -m 777 quagga/zebra/zebra.conf.sample $(INSTALLDIR)/quagga/usr/local/etc/zebra.conf
2348	libtool --mode=install install -c quagga/ripd/ripd $(INSTALLDIR)/quagga/usr/sbin
2349	install -c -m 777 quagga/ripd/ripd.conf.sample $(INSTALLDIR)/quagga/usr/local/etc/ripd.conf
2350	libtool --mode=install install -c quagga/watchquagga/watchquagga $(INSTALLDIR)/quagga/usr/sbin
2351	$(STRIP) $(INSTALLDIR)/quagga/usr/sbin/zebra
2352	$(STRIP) $(INSTALLDIR)/quagga/usr/sbin/ripd
2353	$(STRIP) $(INSTALLDIR)/quagga/usr/sbin/watchquagga 
2354
2355zebra/stamp-h1:
2356	@cd zebra && rm -f config.cache && \
2357	CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD) \
2358	CFLAGS="-Os -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections" \
2359	LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections -fPIC" \
2360	$(CONFIGURE) --sysconfdir=/etc \
2361	--enable-netlink $(if $(RTCONFIG_IPV6),--enable-ipv6,--disable-ipv6) --disable-ripngd --disable-ospfd --disable-doc \
2362	--disable-ospf6d --disable-bgpd --disable-bgpd-announce
2363	@touch $@
2364
2365zebra: zebra/stamp-h1
2366	@$(MAKE) -C zebra CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD)
2367
2368zebra-clean:
2369	-@$(MAKE) -C zebra clean
2370	@rm -f zebra/stamp-h1
2371
2372zebra-install: zebra
2373	install -D zebra/zebra/zebra $(INSTALLDIR)/zebra/usr/sbin/zebra
2374	install -D zebra/ripd/ripd $(INSTALLDIR)/zebra/usr/sbin/ripd
2375	install -D zebra/lib/libzebra.so $(INSTALLDIR)/zebra/usr/lib/libzebra.so
2376	$(STRIP) $(INSTALLDIR)/zebra/usr/sbin/zebra
2377	$(STRIP) $(INSTALLDIR)/zebra/usr/sbin/ripd
2378	$(STRIP) $(INSTALLDIR)/zebra/usr/lib/libzebra.so
2379
2380bpalogin-install:
2381	install -D bpalogin/bpalogin $(INSTALLDIR)/bpalogin/usr/sbin/bpalogin
2382	$(STRIP) $(INSTALLDIR)/bpalogin/usr/sbin/bpalogin
2383
2384wpa_supplicant-0.7.3/stamp-h1:
2385	touch $@
2386
2387wpa_supplicant-0.7.3: $@/stamp-h1
2388	$(MAKE) -C $@/src/eap_peer
2389
2390wpa_supplicant-0.7.3-install: wpa_supplicant-0.7.3
2391	install -D wpa_supplicant-0.7.3/src/eap_peer/libeap.so.0.0.0 $(INSTALLDIR)/wpa_supplicant-0.7.3/usr/lib/libeap.so.0.0.0
2392	$(STRIP) $(INSTALLDIR)/wpa_supplicant-0.7.3/usr/lib/libeap.so.0.0.0
2393	cd $(INSTALLDIR)/wpa_supplicant-0.7.3/usr/lib && \
2394	ln -sf libeap.so.0.0.0 $(INSTALLDIR)/wpa_supplicant-0.7.3/usr/lib/libeap.so.0
2395	ln -sf libeap.so.0.0.0 $(INSTALLDIR)/wpa_supplicant-0.7.3/usr/lib/libeap.so
2396
2397wpa_supplicant-0.7.3-clean:
2398	-@$(MAKE) -C wpa_supplicant-0.7.3/src/eap_peer clean
2399	@rm -f wpa_supplicant-0.7.3/stamp-h1
2400
2401gctwimax-0.0.3rc4/stamp-h1:
2402	touch $@
2403
2404gctwimax-0.0.3rc4: $@/stamp-h1
2405	$(MAKE) -C $@
2406
2407gctwimax-0.0.3rc4-install: gctwimax-0.0.3rc4
2408	install -D gctwimax-0.0.3rc4/gctwimax $(INSTALLDIR)/gctwimax-0.0.3rc4/usr/sbin/gctwimax
2409	$(STRIP) $(INSTALLDIR)/gctwimax-0.0.3rc4/usr/sbin/gctwimax
2410	#install -D gctwimax-0.0.3rc4/src/event.sh $(INSTALLDIR)/gctwimax-0.0.3rc4/usr/share/event.sh
2411	#install -D gctwimax-0.0.3rc4/src/gctwimax.conf $(INSTALLDIR)/gctwimax-0.0.3rc4/usr/share/gctwimax.conf
2412
2413gctwimax-0.0.3rc4-clean:
2414	-@$(MAKE) -C gctwimax-0.0.3rc4 clean
2415	@rm -f gctwimax-0.0.3rc4/stamp-h1
2416
2417wpa_supplicant:
2418	$(MAKE) -C $@/wpa_supplicant EXTRACFLAGS="-Os $(EXTRACFLAGS)"
2419
2420wpa_supplicant-install: wpa_supplicant
2421	install -D wpa_supplicant/wpa_supplicant/wpa_supplicant $(INSTALLDIR)/wpa_supplicant/usr/sbin/wpa_supplicant
2422	install -D wpa_supplicant/wpa_supplicant/wpa_cli $(INSTALLDIR)/wpa_supplicant/usr/sbin/wpa_cli
2423	$(STRIP) $(INSTALLDIR)/wpa_supplicant/usr/sbin/*
2424
2425wpa_supplicant-clean:
2426	-@$(MAKE) -C wpa_supplicant/wpa_supplicant clean
2427
2428tr069:
2429	cp tr069/Makefile.ASUSWRT tr069/Makefile
2430	$(MAKE) -C $@
2431	$(MAKE) -C $@/test
2432
2433tr069-clean:
2434	-$(MAKE) -C tr069 clean
2435	-$(MAKE) -C tr069/test clean
2436
2437tr069-install: tr069
2438	install -D tr069/build/bin/tr $(INSTALLDIR)/tr069/sbin/tr069
2439	install -D tr069/test/sendtocli $(INSTALLDIR)/tr069/sbin/sendtocli
2440	install -D tr069/test/notify $(INSTALLDIR)/tr069/sbin/notify
2441	install -D tr069/test/udpclient $(INSTALLDIR)/tr069/sbin/udpclient
2442ifeq ($(RTCONFIG_TR181),y)
2443ifeq ($(RTCONFIG_DSL),y)
2444	install -D tr069/conf/ASUSWRT/tr_181.xml.dsl $(INSTALLDIR)/tr069/usr/tr/tr.xml
2445else
2446	install -D tr069/conf/ASUSWRT/tr_181.xml $(INSTALLDIR)/tr069/usr/tr/tr.xml
2447endif
2448else
2449ifeq ($(RTCONFIG_DSL),y)
2450	install -D tr069/conf/ASUSWRT/tr_98.xml.dsl $(INSTALLDIR)/tr069/usr/tr/tr.xml
2451else
2452	install -D tr069/conf/ASUSWRT/tr_98.xml $(INSTALLDIR)/tr069/usr/tr/tr.xml
2453endif
2454endif
2455
2456nt_center/stamp-h1: 
2457	touch $@
2458
2459nt_center: nt_center/stamp-h1
2460	$(MAKE) -C nt_center
2461
2462
2463nt_center-install: nt_center
2464	install -d $(INSTALLDIR)/nt_center/usr/lib/
2465	install -d $(INSTALLDIR)/nt_center/usr/sbin/
2466	install -D nt_center/lib/libnt.so $(INSTALLDIR)/nt_center/usr/lib/libnt.so
2467	install -D nt_center/nt_center $(INSTALLDIR)/nt_center/usr/sbin/nt_center
2468	install -D nt_center/nt_monitor $(INSTALLDIR)/nt_center/usr/sbin/nt_monitor
2469	install -D nt_center/actMail/nt_actMail $(INSTALLDIR)/nt_center/usr/sbin/nt_actMail
2470	install -D nt_center/Notify_Event2NC $(INSTALLDIR)/nt_center/usr/sbin/Notify_Event2NC
2471	install -D nt_center/lib/nt_db $(INSTALLDIR)/nt_center/usr/sbin/nt_db
2472	#install -D nt_center/lib/db_test $(INSTALLDIR)/nt_center/usr/sbin/db_test
2473	$(STRIP) $(INSTALLDIR)/nt_center/usr/lib/libnt.so
2474	$(STRIP) $(INSTALLDIR)/nt_center/usr/sbin/nt_center
2475	$(STRIP) $(INSTALLDIR)/nt_center/usr/sbin/nt_monitor
2476	$(STRIP) $(INSTALLDIR)/nt_center/usr/sbin/nt_actMail
2477	$(STRIP) $(INSTALLDIR)/nt_center/usr/sbin/Notify_Event2NC
2478	$(STRIP) $(INSTALLDIR)/nt_center/usr/sbin/nt_db
2479	#$(STRIP) $(INSTALLDIR)/nt_center/usr/sbin/db_test
2480
2481nt_center-clean:
2482	-$(MAKE) -C nt_center clean
2483	@rm -f nt_center/stamp-h1
2484
2485#	$(STRIP) $(INSTALLDIR)/tr/sbin/*
2486
2487#	libnet:
2488#		@$(SEP)
2489#		@-mkdir -p libnet/lib
2490#		@$(MAKE) -C libnet CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
2491
2492libpcap/stamp-h1:
2493	cd libpcap && $(CONFIGURE) --with-pcap=linux
2494	touch $@
2495
2496libpcap: libpcap/stamp-h1
2497	@$(SEP)
2498	@$(MAKE) -C libpcap CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
2499
2500libpcap-install: libpcap
2501	@echo "do nothing"
2502	#install -D libpcap/libpcap.so.1.4.0 $(INSTALLDIR)/libpcap/usr/lib/libpcap.so.1.4.0
2503	#$(STRIP) $(INSTALLDIR)/libpcap/usr/lib/libpcap.so.1.4.0
2504	#cd $(INSTALLDIR)/libpcap/usr/lib && ln -sf libpcap.so.1.4.0 libpcap.so
2505
2506libpcap-clean:
2507	[ ! -f libpcap/Makefile ] || $(MAKE) -C libpcap clean
2508	@rm -f libpcap/stamp-h1
2509
2510tcpdump-4.4.0/stamp-h1:
2511	cd tcpdump-4.4.0 && $(CONFIGURE) ac_cv_linux_vers=2
2512	touch $@
2513
2514tcpdump-4.4.0:  libpcap tcpdump-4.4.0/stamp-h1
2515	@$(SEP)
2516	@$(MAKE) -C tcpdump-4.4.0 CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
2517
2518tcpdump-4.4.0-install: tcpdump-4.4.0
2519	install -D tcpdump-4.4.0/tcpdump $(INSTALLDIR)/tcpdump-4.4.0/usr/sbin/tcpdump
2520	$(STRIP) $(INSTALLDIR)/tcpdump-4.4.0/usr/sbin/tcpdump
2521
2522tcpdump-4.4.0-clean:
2523	[ ! -f tcpdump-4.4.0/Makefile ] || $(MAKE) -C tcpdump-4.4.0 clean
2524	@rm -f tcpdump-4.4.0/stamp-h1
2525
2526libqcsapi_client-install: libqcsapi_client
2527	install -d $(INSTALLDIR)/libqcsapi_client/usr/lib/
2528	install -d $(INSTALLDIR)/libqcsapi_client/usr/sbin/
2529	install -D libqcsapi_client/libqcsapi_client.so.1.0.1 $(INSTALLDIR)/libqcsapi_client/usr/lib/
2530	install -D libqcsapi_client/qcsapi_sockrpc $(INSTALLDIR)/libqcsapi_client/usr/sbin/
2531	install -D libqcsapi_client/qcsapi_sockraw $(INSTALLDIR)/libqcsapi_client/usr/sbin/
2532	# install -D libqcsapi_client/c_rpc_qcsapi_sample $(INSTALLDIR)/libqcsapi_client/usr/sbin/
2533	$(STRIP) $(INSTALLDIR)/libqcsapi_client/usr/lib/*.so.*
2534	$(STRIP) $(INSTALLDIR)/libqcsapi_client/usr/sbin/*
2535	cd $(INSTALLDIR)/libqcsapi_client/usr/lib && \
2536		ln -sf libqcsapi_client.so.1.0.1 libqcsapi_client.so.1 && \
2537		ln -sf libqcsapi_client.so.1.0.1 libqcsapi_client.so
2538
2539libbcm:
2540	@[ ! -f libbcm/Makefile ] || $(MAKE) -C libbcm
2541
2542libbcm-install:
2543	install -D libbcm/libbcm.so $(INSTALLDIR)/libbcm/usr/lib/libbcm.so
2544	$(STRIP) $(INSTALLDIR)/libbcm/usr/lib/libbcm.so
2545
2546.PHONY: libnl-tiny-0.1 swconfig
2547libnl-tiny-0.1:
2548	$(MAKE) -C $@
2549
2550libnl-tiny-0.1-clean:
2551	$(MAKE) -C libnl-tiny-0.1 clean
2552
2553libnl-tiny-0.1-install: libnl-tiny-0.1
2554	install -D libnl-tiny-0.1/libnl-tiny.so $(INSTALLDIR)/libnl-tiny-0.1/usr/lib/libnl-tiny.so
2555	$(STRIP) $(INSTALLDIR)/libnl-tiny-0.1/usr/lib/libnl-tiny.so
2556
2557swconfig: libnl-tiny-0.1
2558	$(MAKE) -C $@
2559
2560swconfig-clean:
2561	$(MAKE) -C swconfig clean
2562
2563swconfig-install: swconfig
2564	install -D swconfig/swconfig $(INSTALLDIR)/swconfig/usr/sbin/swconfig
2565	$(STRIP) $(INSTALLDIR)/swconfig/usr/sbin/swconfig
2566
2567iperf: iperf/Makefile
2568	@$(SEP)
2569	$(MAKE) -C $@
2570
2571iperf/Makefile:
2572	# libstdc++.so.6 is required if you want to remove CFLAGS=-static below.
2573	( cd iperf ; CFLAGS=-static $(CONFIGURE) ac_cv_func_malloc_0_nonnull=yes )
2574
2575iperf-install:
2576	install -D iperf/src/iperf $(INSTALLDIR)/iperf/usr/bin/iperf
2577	$(STRIP) $(INSTALLDIR)/iperf/usr/bin/iperf
2578
2579iperf-clean:
2580	[ ! -f iperf/Makefile ] || $(MAKE) -C iperf distclean
2581	@rm -f iperf/Makefile
2582
2583libevent-2.0.21: libevent-2.0.21/Makefile
2584	$(MAKE) -C $@ && $(MAKE) $@-stage
2585
2586libevent-2.0.21/Makefile:
2587	$(MAKE) libevent-2.0.21-configure
2588
2589libevent-2.0.21-configure:
2590	( cd libevent-2.0.21 ; CFLAGS="$(CFLAGS) -Os -Wall $(EXTRACFLAGS)" \
2591		$(CONFIGURE) --prefix=/usr --bindir=/usr/sbin --libdir=/usr/lib \
2592	)
2593
2594libevent-2.0.21-install: libevent-2.0.21
2595	install -D $(STAGEDIR)/usr/lib/libevent-2.0.so.5 $(INSTALLDIR)/$</usr/lib/libevent-2.0.so.5
2596	$(STRIP) $(INSTALLDIR)/$</usr/lib/libevent-2.0.so*
2597
2598libevent-2.0.21-clean:
2599	[ ! -f libevent-2.0.21/Makefile ] || $(MAKE) -C libevent-2.0.21 clean
2600	@rm -f libevent-2.0.21/Makefile
2601
2602tor-0.2.5.10: openssl zlib libevent-2.0.21 tor-0.2.5.10/Makefile
2603	@$(SEP)
2604	$(MAKE) -C $@
2605
2606tor-0.2.5.10/Makefile:
2607	(cd tor-0.2.5.10 ; $(CONFIGURE) --enable-static-libevent --with-libevent-dir=$(TOP)/libevent \
2608					--enable-static-openssl --with-openssl-dir=$(TOP)/openssl \
2609					--enable-static-zlib --with-zlib-dir=$(TOP)/zlib)
2610
2611tor-0.2.5.10-install: tor-0.2.5.10
2612	install -D tor-0.2.5.10/src/or/tor $(INSTALLDIR)/tor-0.2.5.10/usr/sbin/Tor
2613	$(STRIP) $(INSTALLDIR)/tor-0.2.5.10/usr/sbin/Tor
2614
2615tor-0.2.5.10-clean:
2616	[ ! -f tor-0.2.5.10/Makefile ] || $(MAKE) -C tor-0.2.5.10 clean
2617	@rm -f tor-0.2.5.10/Makefile
2618
2619iproute2:
2620	@$(SEP)
2621	@$(MAKE) -C $@ KERNEL_INCLUDE=$(LINUXDIR)/include EXTRACFLAGS="$(EXTRACFLAGS) $(if $(RTCONFIG_IPV6),-DUSE_IPV6,-DNO_IPV6)"
2622
2623iproute2-install: iproute2
2624	install -D iproute2/tc/tc $(INSTALLDIR)/iproute2/usr/sbin/tc
2625	$(STRIP) $(INSTALLDIR)/iproute2/usr/sbin/tc
2626	install -D iproute2/ip/ip $(INSTALLDIR)/iproute2/usr/sbin/ip
2627	$(STRIP) $(INSTALLDIR)/iproute2/usr/sbin/ip
2628
2629iproute2-3.x: kernel_header iptables-1.4.x
2630	@$(SEP)
2631	@$(MAKE) -C $@ IPTABLES_DIR=$(TOP)/iptables-1.4.x KERNEL_INCLUDE=$(TOP)/kernel_header/include EXTRACFLAGS="$(EXTRACFLAGS) $(if $(RTCONFIG_IPV6),-DUSE_IPV6,-DNO_IPV6)"
2632
2633iproute2-3.x-install: iproute2-3.x
2634	install -D iproute2-3.x/tc/tc $(INSTALLDIR)/iproute2-3.x/usr/sbin/tc
2635	$(STRIP) $(INSTALLDIR)/iproute2-3.x/usr/sbin/tc
2636	install -D iproute2-3.x/ip/ip $(INSTALLDIR)/iproute2-3.x/usr/sbin/ip
2637	$(STRIP) $(INSTALLDIR)/iproute2-3.x/usr/sbin/ip
2638	@if [ -e iproute2-3.x/tc/m_xt.so ] ; then \
2639		install -D iproute2-3.x/tc/m_xt.so $(INSTALLDIR)/iproute2-3.x/usr/lib/tc/m_xt.so ; \
2640		ln -sf m_xt.so $(INSTALLDIR)/iproute2-3.x/usr/lib/tc/m_ipt.so ; \
2641		$(STRIP) $(INSTALLDIR)/iproute2-3.x/usr/lib/tc/*.so ; \
2642	fi
2643
2644iproute2-3.x-clean:
2645	-@$(MAKE) -C iproute2-3.x clean
2646	-rm -f iproute2-3.x/Config
2647
2648ntpclient: nvram$(BCMEX) shared
2649
2650rstats: nvram$(BCMEX) shared
2651
2652dropbear: dropbear/config.h
2653	@$(SEP)
2654	@$(MAKE) -C dropbear PROGRAMS="dropbear dbclient dropbearkey scp" MULTI=1
2655
2656dropbear-install:
2657	install -D dropbear/dropbearmulti $(INSTALLDIR)/dropbear/usr/bin/dropbearmulti
2658	$(STRIP) $(INSTALLDIR)/dropbear/usr/bin/dropbearmulti
2659	cd $(INSTALLDIR)/dropbear/usr/bin && \
2660	ln -sf dropbearmulti dropbear && \
2661	ln -sf dropbearmulti dropbearconvert && \
2662	ln -sf dropbearmulti dropbearkey && \
2663	ln -sf dropbearmulti dbclient && \
2664	ln -sf dropbearmulti ssh && \
2665	ln -sf dropbearmulti scp
2666
2667dropbear-clean:
2668	-@$(MAKE) -C dropbear clean
2669	@rm -f dropbear/config.h
2670
2671dropbear/config.h:
2672	cd dropbear && CFLAGS="-Os -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections" \
2673		LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections" \
2674		ac_cv_func_logout=no ac_cv_func_logwtmp=no \
2675		$(CONFIGURE) --disable-zlib --enable-syslog --disable-lastlog --disable-utmp \
2676		--disable-utmpx --disable-wtmp --disable-wtmpx --disable-pututline \
2677		--disable-pututxline --disable-loginfunc --disable-pam --enable-openpty
2678	-@$(MAKE) -C dropbear clean
2679
2680wtfast-configure:
2681	@true
2682
2683wtfast-install:
2684	install -D wtfast/wtfslhd/wtfslhd $(INSTALLDIR)/wtfast/usr/sbin/wtfslhd
2685
2686# Media libraries
2687
2688sqlite/stamp-h1:
2689	cd sqlite && \
2690	CC=$(CC) CFLAGS="-Os $(EXTRACFLAGS) -ffunction-sections -fdata-sections -fPIC" \
2691		LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections -lpthread -ldl" \
2692		$(CONFIGURE) --prefix=/usr --enable-shared --enable-static \
2693		--disable-readline --disable-dynamic-extensions --enable-threadsafe \
2694		--disable-dependency-tracking
2695	touch $@
2696
2697sqlite: sqlite/stamp-h1
2698	@$(MAKE) -C sqlite all
2699
2700sqlite-clean:
2701	-@$(MAKE) -C sqlite clean
2702	@rm -f sqlite/stamp-h1
2703
2704sqlite-install: sqlite
2705	@$(SEP)
2706
2707# commented out for mt-daapd-svn-1696
2708ifneq ($(MEDIA_SERVER_STATIC),y)
2709	install -D sqlite/.libs/libsqlite3.so.0 $(INSTALLDIR)/sqlite/usr/lib/libsqlite3.so.0
2710	$(STRIP) $(INSTALLDIR)/sqlite/usr/lib/libsqlite3.so.0
2711endif
2712
2713FFMPEG_FILTER_CONFIG= $(foreach c, $(2), --$(1)="$(c)")
2714
2715FFMPEG_DECODERS:=aac ac3 atrac3 h264 jpegls mp3 mpeg1video mpeg2video mpeg4 mpeg4aac mpegvideo png wmav1 wmav2
2716FFMPEG_CONFIGURE_DECODERS:=$(call FFMPEG_FILTER_CONFIG,enable-decoder,$(FFMPEG_DECODERS))
2717
2718FFMPEG_PARSERS:=aac ac3 h264 mpeg4video mpegaudio mpegvideo
2719FFMPEG_CONFIGURE_PARSERS:=$(call FFMPEG_FILTER_CONFIG,enable-parser,$(FFMPEG_PARSERS))
2720
2721FFMPEG_PROTOCOLS:=file
2722FFMPEG_CONFIGURE_PROTOCOLS:=$(call FFMPEG_FILTER_CONFIG,enable-protocol,$(FFMPEG_PROTOCOLS))
2723
2724FFMPEG_DISABLED_DEMUXERS:=amr apc ape ass bethsoftvid bfi c93 daud dnxhd dsicin dxa ffm gsm gxf idcin iff image2 image2pipe ingenient ipmovie lmlm4 mm mmf msnwc_tcp mtv mxf nsv nut oma pva rawvideo rl2 roq rpl segafilm shorten siff smacker sol str thp tiertexseq tta txd vmd voc wc3 wsaud wsvqa xa yuv4mpegpipe
2725FFMPEG_CONFIGURE_DEMUXERS:=$(call FFMPEG_FILTER_CONFIG,disable-demuxer,$(FFMPEG_DISABLED_DEMUXERS))
2726
2727ffmpeg/stamp-h1: zlib
2728	cd ffmpeg && symver_asm_label=no symver_gnu_asm=no symver=no CC=$(CC) LDFLAGS="-ldl"\
2729		./configure --enable-cross-compile --arch=$(ARCH) --target_os=linux \
2730		--cross-prefix=$(CROSS_COMPILE) --enable-shared --enable-gpl --disable-doc \
2731		--enable-pthreads --enable-small --disable-encoders --disable-filters \
2732		--disable-muxers --disable-devices --disable-ffmpeg --disable-ffplay \
2733		--disable-ffserver --disable-ffprobe --disable-avdevice --disable-swscale \
2734		--disable-hwaccels --disable-network --disable-bsfs --disable-mpegaudio-hp \
2735		--enable-demuxers $(FFMPEG_CONFIGURE_DEMUXERS) \
2736		--disable-decoders $(FFMPEG_CONFIGURE_DECODERS) \
2737		--disable-parsers $(FFMPEG_CONFIGURE_PARSERS) \
2738		--disable-protocols $(FFMPEG_CONFIGURE_PROTOCOLS) \
2739		--extra-cflags="-Os $(EXTRACFLAGS) -ffunction-sections -fdata-sections -fPIC -I$(TOP)/zlib" \
2740		--extra-ldflags="-ffunction-sections -fdata-sections -Wl,--gc-sections -fPIC" \
2741		--extra-libs="-L$(TOP)/zlib -lz" \
2742		--enable-zlib --disable-debug --prefix=''
2743	touch $@
2744
2745ffmpeg: ffmpeg/stamp-h1 zlib
2746	@$(MAKE) -C ffmpeg all
2747
2748ffmpeg-clean:
2749	-@$(MAKE) -C ffmpeg clean
2750	@rm -f ffmpeg/stamp-h1 ffmpeg/config.h ffmpeg/config.mak
2751
2752ffmpeg-install: ffmpeg
2753	@$(SEP)
2754ifneq ($(MEDIA_SERVER_STATIC),y)
2755	install -D ffmpeg/libavformat/libavformat.so.52 $(INSTALLDIR)/ffmpeg/usr/lib/libavformat.so.52
2756	install -D ffmpeg/libavcodec/libavcodec.so.52 $(INSTALLDIR)/ffmpeg/usr/lib/libavcodec.so.52
2757	install -D ffmpeg/libavutil/libavutil.so.50 $(INSTALLDIR)/ffmpeg/usr/lib/libavutil.so.50
2758	$(STRIP) $(INSTALLDIR)/ffmpeg/usr/lib/libavformat.so.52
2759	$(STRIP) $(INSTALLDIR)/ffmpeg/usr/lib/libavcodec.so.52
2760	$(STRIP) $(INSTALLDIR)/ffmpeg/usr/lib/libavutil.so.50
2761endif
2762
2763libogg/stamp-h1:
2764	cd libogg && \
2765	CFLAGS="-Os $(EXTRACFLAGS) -fPIC -ffunction-sections -fdata-sections" \
2766	LDFLAGS="-fPIC -ffunction-sections -fdata-sections -Wl,--gc-sections" \
2767	$(CONFIGURE) --enable-shared --enable-static --prefix=''
2768	touch $@
2769
2770libogg: libogg/stamp-h1
2771	@$(MAKE) -C libogg all
2772
2773libogg-clean:
2774	-@$(MAKE) -C libogg clean
2775	@rm -f libogg/stamp-h1
2776
2777libogg-install: libogg
2778	@$(SEP)
2779ifneq ($(MEDIA_SERVER_STATIC),y)
2780	install -D libogg/src/.libs/libogg.so.0 $(INSTALLDIR)/libogg/usr/lib/libogg.so.0
2781	$(STRIP) $(INSTALLDIR)/libogg/usr/lib/libogg.so.0
2782endif
2783
2784flac/stamp-h1: libogg
2785	cd flac && \
2786	CFLAGS="-Os $(EXTRACFLAGS) -fPIC -ffunction-sections -fdata-sections" \
2787	CPPFLAGS="-I$(TOP)/libogg/include" \
2788	LDFLAGS="-L$(TOP)/libogg/src/.libs -fPIC -ffunction-sections -fdata-sections -Wl,--gc-sections" \
2789	$(CONFIGURE) --enable-shared --enable-static --prefix='' --disable-rpath \
2790		--disable-doxygen-docs --disable-xmms-plugin --disable-cpplibs \
2791		--without-libiconv-prefix --disable-altivec --disable-3dnow --disable-sse
2792	touch $@
2793
2794flac: flac/stamp-h1 libogg
2795	@$(MAKE) -C flac/src/libFLAC all
2796
2797flac-clean:
2798	-@$(MAKE) -C flac clean
2799	@rm -f flac/stamp-h1
2800
2801flac-install: flac
2802	@$(SEP)
2803ifneq ($(MEDIA_SERVER_STATIC),y)
2804	install -D flac/src/libFLAC/.libs/libFLAC.so.8 $(INSTALLDIR)/flac/usr/lib/libFLAC.so.8
2805	$(STRIP) $(INSTALLDIR)/flac/usr/lib/libFLAC.so.8
2806endif
2807
2808jpeg/stamp-h1:
2809	cd jpeg && \
2810	CFLAGS="-Os $(EXTRACFLAGS) -fPIC" CC=$(CC) AR2="touch" $(CONFIGURE) --enable-maxmem=1 --enable-shared --enable-static --prefix=''
2811	touch $@
2812
2813jpeg: jpeg/stamp-h1
2814	@$(MAKE) -C jpeg LIBTOOL="" O=o A=a CC=$(CC) AR2="touch" libjpeg.a libjpeg.so
2815
2816jpeg-clean:
2817	-@$(MAKE) -C jpeg clean
2818	@rm -f jpeg/stamp-h1
2819
2820jpeg-install: jpeg
2821	@$(SEP)
2822ifneq ($(MEDIA_SERVER_STATIC),y)
2823	install -D jpeg/libjpeg.so $(INSTALLDIR)/jpeg/usr/lib/libjpeg.so
2824	$(STRIP) $(INSTALLDIR)/jpeg/usr/lib/libjpeg.so
2825endif
2826
2827libexif/stamp-h1:
2828	cd libexif && CFLAGS="-Os -Wall $(EXTRACFLAGS) -fPIC -ffunction-sections -fdata-sections" \
2829	LDFLAGS="-fPIC -ffunction-sections -fdata-sections -Wl,--gc-sections" \
2830	$(CONFIGURE) --enable-shared --enable-static --prefix='' \
2831		--disable-docs --disable-rpath --disable-nls --without-libiconv-prefix --without-libintl-prefix
2832	touch $@
2833
2834libexif: libexif/stamp-h1
2835	@$(MAKE) -C libexif all
2836
2837libexif-clean:
2838	-@$(MAKE) -C libexif clean
2839	@rm -f libexif/stamp-h1
2840
2841libexif-install: libexif
2842	@$(SEP)
2843ifneq ($(MEDIA_SERVER_STATIC),y)
2844	install -D libexif/libexif/.libs/libexif.so.12 $(INSTALLDIR)/libexif/usr/lib/libexif.so.12
2845	$(STRIP) $(INSTALLDIR)/libexif/usr/lib/libexif.so.12
2846endif
2847
2848zlib/stamp-h1:
2849	cd zlib && \
2850	CC=$(CC) AR="ar rc" RANLIB=$(RANLIB) LD=$(LD) CFLAGS="-Os -Wall $(EXTRACFLAGS) -fPIC" LDSHAREDLIBC="$(EXTRALDFLAGS)" \
2851	./configure --shared --prefix=/usr --libdir=/usr/lib
2852	touch $@
2853
2854zlib: zlib/stamp-h1
2855	@$(MAKE) -C zlib CC=$(CC) AR="ar rc" RANLIB=$(RANLIB) LD=$(LD) all && $(MAKE) $@-stage
2856
2857zlib-clean:
2858	-@$(MAKE) -C zlib clean
2859	@rm -f zlib/stamp-h1
2860
2861zlib-install: zlib
2862	@$(SEP)
2863# commented out for mt-daapd-svn-1696
2864ifneq ($(MEDIA_SERVER_STATIC),y)
2865	install -d $(INSTALLDIR)/zlib/usr/lib
2866	install -D zlib/libz.so.1 $(INSTALLDIR)/zlib/usr/lib/
2867	$(STRIP) $(INSTALLDIR)/zlib/usr/lib/libz.so.1
2868endif
2869ifeq ($(or $(RTCONFIG_USB_BECEEM),$(RTCONFIG_MEDIA_SERVER),$(RTCONFIG_CLOUDSYNC),$(RTCONFIG_PUSH_EMAIL)),y)
2870	install -d $(INSTALLDIR)/zlib/usr/lib
2871	install -D zlib/libz.so.1 $(INSTALLDIR)/zlib/usr/lib/
2872	$(STRIP) $(INSTALLDIR)/zlib/usr/lib/libz.so.1
2873endif
2874
2875libid3tag/stamp-h1: zlib
2876	cd libid3tag && \
2877	CFLAGS="-Os -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections" CPPFLAGS="-I$(TOP)/zlib" \
2878	LDFLAGS="-L$(TOP)/zlib -fPIC -ffunction-sections -fdata-sections -Wl,--gc-sections" \
2879	$(CONFIGURE) --enable-shared --enable-static --prefix='' \
2880		--disable-debugging --disable-profiling --disable-dependency-tracking
2881	touch $@
2882
2883libid3tag: libid3tag/stamp-h1 zlib
2884	@$(MAKE) -C libid3tag all
2885
2886libid3tag-clean:
2887	-@$(MAKE) -C libid3tag clean
2888	@rm -f libid3tag/stamp-h1
2889
2890libid3tag-install: libid3tag
2891	@$(SEP)
2892#commented out for mt-daapd-svn-1696
2893ifneq ($(MEDIA_SERVER_STATIC),y)
2894	install -D libid3tag/.libs/libid3tag.so.0 $(INSTALLDIR)/libid3tag/usr/lib/libid3tag.so.0
2895	$(STRIP) $(INSTALLDIR)/libid3tag/usr/lib/libid3tag.so.0
2896endif
2897
2898libvorbis/stamp-h1: libogg
2899	cd libvorbis && \
2900	CFLAGS="-Os -Wall $(EXTRACFLAGS) -fPIC -ffunction-sections -fdata-sections" \
2901	CPPFLAGS="-I$(TOP)/libogg/include" \
2902	LDFLAGS="-L$(TOP)/libogg/src/.libs -fPIC -ffunction-sections -fdata-sections -Wl,--gc-sections -ldl" \
2903	$(CONFIGURE) --enable-shared --enable-static --prefix='' --disable-oggtest \
2904		--with-ogg-includes="$(TOP)/libogg/include" \
2905		--with-ogg-libraries="$(TOP)/libogg/src/.libs"
2906	touch $@
2907	touch libvorbis/aclocal.m4
2908
2909libvorbis: libvorbis/stamp-h1
2910	@$(MAKE) -C libvorbis/lib all
2911
2912libvorbis-clean:
2913	-@$(MAKE) -C libvorbis clean
2914	@rm -f libvorbis/stamp-h1
2915
2916libvorbis-install: libvorbis
2917	@$(SEP)
2918ifneq ($(MEDIA_SERVER_STATIC),y)
2919	install -D libvorbis/lib/.libs/libvorbis.so.0 $(INSTALLDIR)/libvorbis/usr/lib/libvorbis.so.0
2920	$(STRIP) $(INSTALLDIR)/libvorbis/usr/lib/libvorbis.so.0
2921endif
2922
2923minidlna: zlib sqlite ffmpeg libogg flac jpeg libexif libid3tag libvorbis
2924	@$(SEP)
2925	@cd minidlna && ./genosver.sh
2926	@$(MAKE) -C minidlna CC=$(CC) $(if $(MEDIA_SERVER_STATIC),STATIC=1) minidlna
2927
2928libgdbm/stamp-h1:
2929	cd libgdbm && \
2930	CFLAGS="-Os -Wall $(EXTRACFLAGS) -fPIC -ffunction-sections -fdata-sections" \
2931	CPPFLAGS="-I$(TOP)/zlib" \
2932	LDFLAGS="-fPIC -ffunction-sections -fdata-sections -Wl,--gc-sections" \
2933	$(CONFIGURE) --enable-shared --enable-static --prefix=''
2934	touch $@
2935
2936libgdbm: libgdbm/stamp-h1
2937	@$(MAKE) -C libgdbm
2938
2939libgdbm-clean:
2940	-@$(MAKE) -C libgdbm clean
2941	@rm -f libgdbm/stamp-h1
2942
2943libgdbm-install: libgdbm
2944	@$(SEP)
2945ifneq ($(MEDIA_SERVER_STATIC),y)
2946	install -D libgdbm/.libs/libgdbm.so.3.0.0 $(INSTALLDIR)/libgdbm/usr/lib/libgdbm.so.3.0.0
2947	$(STRIP) $(INSTALLDIR)/libgdbm/usr/lib/libgdbm.so.3.0.0
2948	cd $(INSTALLDIR)/libgdbm/usr/lib && \
2949		ln -sf libgdbm.so.3.0.0 libgdbm.so.3 && \
2950		ln -sf libgdbm.so.3.0.0 libgdbm.so
2951endif
2952
2953mt-daapd: zlib libid3tag libgdbm
2954	@$(SEP)
2955	@$(MAKE) -C mt-daapd CC=$(CC) $(if $(MEDIA_SERVER_STATIC),STATIC=1) all
2956
2957mt-daapd-svn-1696/stamp-h1: zlib libid3tag sqlite
2958	cd mt-daapd-svn-1696 && $(CONFIGURE) --prefix=/usr \
2959	CC=$(CC) \
2960	LDFLAGS="-L$(TOP)/sqlite -L$(TOP)/libid3tag -L$(TOP)/zlib -ldl" \
2961	CFLAGS="-I$(TOP)/zlib" \
2962	--with-id3tag=$(TOP)/libid3tag \
2963	--enable-sqlite3 --with-sqlite3-includes=$(TOP)/sqlite \
2964	--disable-rpath --disable-dependency-tracking \
2965	ac_cv_func_setpgrp_void=yes ac_cv_lib_id3tag_id3_file_open=yes ac_cv_lib_sqlite3_sqlite3_open=yes
2966	touch $@
2967
2968mt-daapd-svn-1696: mt-daapd-svn-1696/stamp-h1
2969	@$(SEP)
2970	@$(MAKE) -C mt-daapd-svn-1696 all
2971
2972mt-daapd-svn-1696-clean:
2973	-@$(MAKE) -C mt-daapd-svn-1696 distclean
2974	@rm -f mt-daapd-svn-1696/stamp-h1
2975
2976mt-daapd-svn-1696-install:
2977	rm -rf $(INSTALLDIR)/rom/mt-daapd/admin-root
2978	rm -rf $(INSTALLDIR)/rom/mt-daapd/plugins
2979	install -d $(INSTALLDIR)/mt-daapd-svn-1696/rom/mt-daapd/plugins
2980	cp -rf mt-daapd-svn-1696/admin-root $(INSTALLDIR)/mt-daapd-svn-1696/rom/mt-daapd
2981	cd $(INSTALLDIR)/mt-daapd-svn-1696/rom/mt-daapd/admin-root && rm -rf `find -name Makefile` && rm -rf `find -name Makefile.in` && rm -rf `find -name Makefile.am`
2982	cp -rf mt-daapd-svn-1696/src/plugins/.libs/*.so $(INSTALLDIR)/mt-daapd-svn-1696/rom/mt-daapd/plugins
2983	install -D mt-daapd-svn-1696/src/.libs/mt-daapd $(INSTALLDIR)/mt-daapd-svn-1696/usr/sbin/mt-daapd
2984	$(STRIP) $(INSTALLDIR)/mt-daapd-svn-1696/usr/sbin/mt-daapd
2985
2986mDNSResponder:
2987	@$(SEP)
2988	@$(MAKE) -C mDNSResponder CC=$(CC) all
2989
2990
2991igmpproxy/stamp-h1:
2992	cd igmpproxy && CFLAGS="-O2 -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections" \
2993	LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections" \
2994	$(CONFIGURE) --prefix=/usr --disable-dependency-tracking
2995	#touch $@ # will be generated by configure.
2996
2997igmpproxy: igmpproxy/stamp-h1
2998	@$(SEP)
2999	@$(MAKE) -C igmpproxy/src
3000
3001igmpproxy-install: igmpproxy
3002	install -D igmpproxy/src/igmpproxy $(INSTALLDIR)/igmpproxy/usr/sbin/igmpproxy
3003	$(STRIP) $(INSTALLDIR)/igmpproxy/usr/sbin/igmpproxy
3004
3005igmpproxy-clean:
3006	-@$(MAKE) -C igmpproxy/src clean
3007	@rm -f igmpproxy/stamp-h1
3008
3009snooper:
3010ifeq ($(RTCONFIG_RALINK),y)
3011	@true
3012else ifeq ($(RTCONFIG_QCA),y)
3013	@true
3014else
3015	$(MAKE) -C snooper SWITCH=broadcom EXTRACFLAGS="-I$(SRCBASE)/include $(EXTRACFLAGS)"
3016endif
3017
3018snooper-install:
3019ifeq ($(RTCONFIG_RALINK),y)
3020	@true
3021else ifeq ($(RTCONFIG_QCA),y)
3022	@true
3023else
3024	install -D snooper/snooper $(INSTALLDIR)/snooper/usr/sbin/snooper
3025	$(STRIP) $(INSTALLDIR)/snooper/usr/sbin/snooper
3026endif
3027
3028snooper-clean:
3029	$(MAKE) -C snooper clean
3030
3031udpxy:
3032	$(MAKE) -C $@ release NO_UDPXREC=yes \
3033	CDEFS="-O2 -ffunction-sections -fdata-sections $(EXTRACFLAGS)" \
3034	LDFLAGS="-Wl,--gc-sections"
3035
3036udpxy-install:
3037	install -D udpxy/udpxy $(INSTALLDIR)/udpxy/usr/sbin/udpxy
3038	$(STRIP) $(INSTALLDIR)/udpxy/usr/sbin/udpxy
3039
3040netconf: $(IPTABLES)
3041	+$(MAKE) LINUXDIR=$(LINUXDIR) -C netconf
3042
3043igmp: netconf
3044	$(MAKE) -C igmp
3045
3046igmp-install: netconf
3047	install -d $(TARGETDIR)
3048	+$(MAKE) -C igmp INSTALLDIR=$(INSTALLDIR) install
3049
3050igmp-clean:
3051	$(MAKE) -C igmp clean
3052
3053wps$(BCMEX)$(EX7): nvram$(BCMEX) shared libupnp$(BCMEX)$(EX7)
3054ifeq ($(RTCONFIG_WPS),y)
3055	-rm -rf $(OLD_SRC)/wps
3056	-ln -s $(SRCBASE)/wps $(OLD_SRC)/wps
3057	[ ! -f wps$(BCMEX)$(EX7)/Makefile ] || $(MAKE) -C wps$(BCMEX)$(EX7) EXTRA_LDFLAGS=$(EXTRALDFLAGS)
3058else
3059	# Prevent to use generic rules"
3060	@true
3061endif
3062
3063wps$(BCMEX)$(EX7)-install:
3064ifeq ($(RTCONFIG_WPS),y)
3065	[ ! -f wps$(BCMEX)$(EX7)/Makefile ] || $(MAKE) -C wps$(BCMEX)$(EX7) INSTALLDIR=$(INSTALLDIR) install
3066else
3067	# Prevent to use generic rules"
3068	@true
3069endif
3070
3071wps$(BCMEX)$(EX7)-clean:
3072ifeq ($(RTCONFIG_WPS),y)
3073	[ ! -f wps$(BCMEX)$(EX7)/Makefile ] || $(MAKE) -C wps$(BCMEX)$(EX7) clean
3074else
3075	# Prevent to use generic rules"
3076	@true
3077endif
3078
3079CHIP=0
3080CLM_BLOBS=router
3081CLM_BLOB_IMAGES := $(CLM_BLOBS:=.clm_bin)
3082OBJCOPY         := $(CROSS_COMPILE)objcopy
3083OBJCOPYFLAGS    := -R .reginfo -R .note -R .comment -R .mdebug -R .logstrs -R .lognums -S
3084OBJCOPYBIN      := $(OBJCOPY) -O binary $(OBJCOPYFLAGS)
3085CLMBASE=$(SRCBASE)/wl/clm
3086ifeq ($(wildcard $(CLMBASE)/private),)
3087%.clm_bin: $(info "CLM In $(CLMBASE)/src/ NOT CREATING new clm_blob ...");
3088	echo $(CLM_BLOB_IMAGES)
3089else
3090%.clm_bin: CHIPID := $(shell if [[ $(CHIP) -gt 5999 ]] ; then echo $(CHIP); else echo $$((0x$(CHIP)));  fi)
3091%.clm_bin: $(CLMBASE)/types/%.clm $(CLMBASE)/private/wlc_clm_data.xml
3092	@echo ClmCompiling config file $*.clm to $*.clm_bin and $*.clm_bin.  Config file content:
3093	cat $(CLMBASE)/types/$*.clm
3094	$(SRCBASE)/tools/build/ClmCompiler --clmapi_include_dir $(CLMBASE)/include --bcmwifi_include_dir $(SRCBASE)/shared/bcmwifi/include --config_file $(CLMBASE)/types/$*.clm $(CLMBASE)/private/wlc_clm_data.xml $(CLMBASE)/src/$*.c
3095	#@echo C compile $*.c to $*.o
3096	##$(LOUD)$(CC) $(call file_cflags,$*.c) -D_FILENAME_=\"$*.c\" -c -o $*.o $*.c
3097	$(LOUD)$(CC) $(call file_cflags,$*.c) -D_FILENAME_=\"$*.c\" -I$(CLMBASE)/include -I$(SRCBASE)/shared/bcmwifi/include -c -o $(CLMBASE)/src/$*.o $(CLMBASE)/src/$*.c
3098	#@echo Linking $*.o to $*.exe
3099	( \
3100		echo 'SECTIONS {'; \
3101		echo '  . = 0;'; \
3102		echo '  .clmdata : {'; \
3103		echo '      *(.*.clm_header)'; \
3104		echo '      *(.rodata.*)'; \
3105		echo '   }'; \
3106		echo '}'; \
3107	) >$(CLMBASE)/src/$*.lds
3108	@echo Done $*.lds .....
3109	##$(LD) -S -Map=$*.map -T $*.lds -o $*.exe $*.o
3110	$(LD) -S -Map=$(CLMBASE)/src/$*.map -T $(CLMBASE)/src/$*.lds -o $(CLMBASE)/src/$*.exe $(CLMBASE)/src/$*.o
3111	#$(SIZE) $(CLMBASE)/src/$*.exe
3112	@echo Done $*.exe .....
3113	#@echo objcopy $*.exe to $*.clm_bin
3114	$(OBJCOPYBIN) $(CLMBASE)/src/$*.exe $(CLMBASE)/src/$*.clm_bin
3115	@echo Done $*.clm_bin
3116	@echo Create clm_blob .....
3117	python $(SRCBASE)/tools/build/blob.py $(CLMBASE)/src/$*.clm_bin $(CLMBASE)/src/$*.clm_blob '$(CHIPID)'
3118	$(RM) $(CLMBASE)/src/$*.o $(CLMBASE)/src/$*.lds $(CLMBASE)/src/$*.map $(CLMBASE)/src/$*.exe
3119endif
3120
3121clm: $(CLM_BLOB_IMAGES)
3122
3123clm-install:
3124	@echo clm-install INSTALLDIR = $(INSTALLDIR) ....
3125	@echo clm-install TARGETDIR = $(TARGETDIR) ....
3126	install -d $(TARGETDIR)/etc/brcm/clm
3127	install -D $(BASEDIR)/src/wl/clm/src/*.clm_blob $(TARGETDIR)/etc/brcm/clm
3128
3129clm-clean:
3130	$(foreach clmb,$(CLM_BLOBS), \
3131		@echo Removing from $(CLMBASE)/src $(clmb).c $(clmb).clm_bin $(clmb).clm_blob; \
3132		$(RM) $(CLMBASE)/src/$(clmb).c; \
3133		$(RM) $(CLMBASE)/src/$(clmb).clm_bin; \
3134		$(RM) $(TARGETDIR)/etc/brcm/clm/$(clmb).clm_blob )
3135
3136SRC_WLEXE = $(SRCBASE_SYS)/wl/exe
3137
3138.PHONY: wlexe
3139
3140$(SRC_WLEXE)/../../include/epivers.h :
3141ifneq ($(wildcard $(SRC_WLEXE)/GNUmakefile),)
3142	$(MAKE) -C $(SRC_WLEXE)/../../include
3143endif
3144
3145wlexe: $(SRC_WLEXE)/../../include/epivers.h
3146ifeq ($(RTCONFIG_WLEXE),y)
3147ifneq ($(wildcard $(SRC_WLEXE)/*.c),)
3148
3149ifneq ($(wildcard $(SRC_WLEXE)/GNUmakefile),)
3150ifeq ($(ARCH),arm)
3151	$(MAKE) TARGETARCH=arm_le ARCH_SFX="" TARGET_PREFIX=$(CROSS_COMPILE) -C $(SRC_WLEXE)
3152else
3153	$(MAKE) TARGETARCH=mips ARCH_SFX="" TARGET_PREFIX=$(CROSS_COMPILE) -C $(SRC_WLEXE)
3154endif
3155	[ -d wlexe ] || install -d wlexe
3156	install $(SRC_WLEXE)/wl wlexe
3157
3158ifeq ($(ARCH),arm)
3159	install $(SRC_WLEXE)/socket_noasd/arm_le/wl_server_socket wlexe
3160else
3161	install $(SRC_WLEXE)/socket_noasd/mips/wl_server_socket wlexe
3162endif
3163endif
3164
3165else
3166	[ -d wlexe ] || install -d wlexe
3167	install $(SRC_WLEXE)/prebuilt/wl wlexe
3168
3169endif
3170endif
3171
3172.PHONY: wlexe-clean
3173wlexe-clean:
3174ifneq ($(wildcard $(SRC_WLEXE)/GNUmakefile),)
3175	$(MAKE) TARGET_PREFIX=$(CROSS_COMPILE) -C $(SRC_WLEXE) clean
3176	$(RM) wlexe/wl	
3177	$(RM) wlexe/wl_server_socket
3178endif
3179
3180.PHONY: wlexe-install
3181wlexe-install:
3182ifeq ($(RTCONFIG_WLEXE),y)
3183ifneq ($(wildcard $(SRC_WLEXE)/GNUmakefile),)
3184	[ ! -d wlexe ] || install -D -m 755 wlexe/wl $(INSTALLDIR)/wlexe/usr/sbin/wl
3185	[ ! -d wlexe ] || install -D -m 755 wlexe/wl_server_socket $(INSTALLDIR)/wlexe/usr/sbin/wl_server_socket
3186	[ ! -d wlexe ] || $(STRIP) $(INSTALLDIR)/wlexe/usr/sbin/wl
3187	[ ! -d wlexe ] || $(STRIP) $(INSTALLDIR)/wlexe/usr/sbin/wl_server_socket
3188endif
3189endif
3190
3191udev:
3192	$(MAKE) -C $@ CROSS_COMPILE=$(CROSS_COMPILE) EXTRACFLAGS="$(EXTRACFLAGS)" \
3193		PROGRAMS=udevtrigger
3194
3195udev-install: udev
3196	install -d $(INSTALLDIR)
3197	install -d $(TARGETDIR)
3198	$(MAKE) -C udev DESTDIR=$(INSTALLDIR) prefix=/udev install-udevtrigger
3199
3200hotplug2:
3201	$(MAKE) -C $@ CROSS_COMPILE=$(CROSS_COMPILE) EXTRACFLAGS="$(EXTRACFLAGS)"
3202
3203hotplug2-install: hotplug2
3204	$(MAKE) -C hotplug2 install PREFIX=$(INSTALLDIR)/hotplug2 SUBDIRS=""
3205	$(MAKE) -C hotplug2/examples install PREFIX=$(INSTALLDIR)/hotplug2/rom KERNELVER=$(LINUX_KERNEL)
3206
3207emf$(BCMEX)$(EX7):
3208	$(MAKE) -C emf$(BCMEX)$(EX7)/emfconf CROSS=$(CROSS_COMPILE)
3209
3210emf$(BCMEX)$(EX7)-install:
3211ifeq ($(RTCONFIG_EMF),y)
3212	install -d $(TARGETDIR)
3213	$(MAKE) -C emf$(BCMEX)$(EX7)/emfconf CROSS=$(CROSS_COMPILE) INSTALLDIR=$(INSTALLDIR) install
3214endif
3215
3216emf$(BCMEX)$(EX7)-clean:
3217	-@$(MAKE) -C emf$(BCMEX)$(EX7)/emfconf clean
3218
3219igs$(BCMEX)$(EX7):
3220	$(MAKE) -C emf$(BCMEX)$(EX7)/igsconf CROSS=$(CROSS_COMPILE)
3221
3222igs$(BCMEX)$(EX7)-install:
3223ifeq ($(RTCONFIG_EMF),y)
3224	install -d $(TARGETDIR)
3225	$(MAKE) -C emf$(BCMEX)$(EX7)/igsconf CROSS=$(CROSS_COMPILE) INSTALLDIR=$(INSTALLDIR) install
3226endif
3227
3228igs$(BCMEX)$(EX7)-clean:
3229	-@$(MAKE) -C emf$(BCMEX)$(EX7)/igsconf clean
3230
3231ebtables: kernel_header dummy
3232	$(MAKE) -C ebtables CC=$(CC) LD=$(LD) \
3233	CFLAGS="-Os $(EXTRACFLAGS) -Wall -Wunused" \
3234	BINDIR="/usr/sbin" LIBDIR="/usr/lib/ebtables" KERNEL_INCLUDES=$(TOP)/kernel_header/include $(if $(RTCONFIG_IPV6),DO_IPV6=1,) $(if $(RTCONFIG_QCA),USE_ARPNAT=1,)
3235
3236ebtables-install: ebtables
3237	install -D ebtables/ebtables $(INSTALLDIR)/ebtables/usr/sbin/ebtables
3238
3239	install -d $(INSTALLDIR)/ebtables/usr/lib
3240	install -d $(INSTALLDIR)/ebtables/usr/lib/ebtables
3241	install -D ebtables/*.so $(INSTALLDIR)/ebtables/usr/lib/
3242	install -D ebtables/extensions/*.so $(INSTALLDIR)/ebtables/usr/lib/ebtables/
3243
3244	$(STRIP) $(INSTALLDIR)/ebtables/usr/sbin/ebtables
3245	$(STRIP) $(INSTALLDIR)/ebtables/usr/lib/ebtables/*.so
3246	$(STRIP) $(INSTALLDIR)/ebtables/usr/lib/libebt*.so
3247
3248ebtables-clean:
3249	-@make -C ebtables clean
3250
3251lzo/stamp-h1:
3252	cd lzo && \
3253	CFLAGS="-Os -Wall $(EXTRACFLAGS)" $(CONFIGURE) --enable-shared --enable-static \
3254		--prefix=/usr \
3255		--bindir=/usr/sbin \
3256		--libdir=/usr/lib
3257	touch $@
3258
3259lzo: lzo/stamp-h1
3260	$(MAKE) -C lzo && $(MAKE) $@-stage
3261
3262lzo-clean:
3263	-@$(MAKE) -C lzo clean
3264	@rm -f lzo/stamp-h1
3265
3266lzo-install: lzo
3267	install -D lzo/src/.libs/liblzo2.so $(INSTALLDIR)/lzo/usr/lib/liblzo2.so.2
3268	$(STRIP) $(INSTALLDIR)/lzo/usr/lib/liblzo2.so.2
3269	cd $(INSTALLDIR)/lzo/usr/lib && ln -sf liblzo2.so.2 liblzo2.so
3270
3271openpam: openpam/Makefile
3272	$(MAKE) -C $@ && $(MAKE) $@-stage
3273
3274openpam/Makefile:
3275	$(MAKE) openpam-configure
3276
3277openpam-configure:
3278	( cd openpam ; \
3279		LDFLAGS=-ldl \
3280		$(CONFIGURE) \
3281		--prefix=/usr \
3282		--bindir=/usr/sbin \
3283		--libdir=/usr/lib \
3284		--without-doc --with-pam-unix \
3285	)
3286
3287openpam-install: openpam
3288	install -D openpam/lib/libpam/.libs/libpam.so.2.0.0 $(INSTALLDIR)/openpam/usr/lib/libpam.so.2
3289	$(STRIP) -s $(INSTALLDIR)/openpam/usr/lib/libpam.so.2
3290	install -D openpam/modules/pam_unix/.libs/pam_unix.so.2.0.0 $(INSTALLDIR)/openpam/usr/lib/pam_unix.so
3291	$(STRIP) -s $(INSTALLDIR)/openpam/usr/lib/pam_unix.so
3292
3293openpam-clean:
3294	[ ! -f openpam/Makefile ] || $(MAKE) -C openpam distclean
3295	@rm -f openpam/Makefile
3296
3297openvpn/dh2048.pem:
3298	openssl dhparam -out $@ 2048
3299
3300openvpn: shared openssl lzo openpam zlib openvpn/dh2048.pem openvpn/Makefile
3301	$(MAKE) -C $@
3302
3303openvpn/Makefile:
3304	$(MAKE) openvpn-configure
3305
3306openvpn-configure:
3307	( cd openvpn ; ./autogen.sh && export OPENSSL_CRYPTO_CFLAGS="-I$(TOP)/openssl"; \
3308		export OPENSSL_CRYPTO_LIBS="-L$(TOP)/openssl -lcrypto"; \
3309		export OPENSSL_SSL_CFLAGS="-I$(TOP)/openssl"; \
3310		export OPENSSL_SSL_LIBS="-L$(TOP)/openssl -lssl"; \
3311		CFLAGS="-Os -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections $(if $(RTCONFIG_HTTPS),-I$(TOP)/openssl/include/openssl)" \
3312		LDFLAGS="$(EXTRALDFLAGS) -L$(TOP)/nvram$(BCMEX) -lnvram -L$(TOP)/shared -lshared $(if $(RTCONFIG_QTN),-L$(TOP)/libqcsapi_client -lqcsapi_client) $(if $(RTCONFIG_HTTPS),-L$(TOP)/openssl -lcrypto -lssl) -L$(TOP)/zlib -lz -lpthread -ldl -L$(TOP)/lzo/src/.libs -L$(TOP)/openpam/lib/libpam/.libs -ffunction-sections -fdata-sections -Wl,--gc-sections" \
3313		CPPFLAGS="-I$(TOP)/lzo/include -I$(TOP)/openssl/include -I$(TOP)/openpam/include -I$(TOP)/shared -I$(SRCBASE)/include" \
3314		IPROUTE="/usr/sbin/ip" IFCONFIG="/sbin/ifconfig" \
3315		$(CONFIGURE) --prefix=/usr --bindir=/usr/sbin --libdir=/usr/lib \
3316			--disable-debug --enable-management --disable-small \
3317			--disable-selinux --disable-socks --enable-password-save \
3318			--enable-plugin-auth-pam \
3319			ac_cv_lib_resolv_gethostbyname=no \
3320	)
3321
3322openvpn-clean:
3323	[ ! -f openvpn/Makefile ] || $(MAKE) -C openvpn clean
3324	@rm -f openvpn/Makefile
3325
3326openvpn-install: openvpn
3327	install -D openvpn/src/openvpn/.libs/openvpn $(INSTALLDIR)/openvpn/usr/sbin/openvpn
3328	$(STRIP) -s $(INSTALLDIR)/openvpn/usr/sbin/openvpn
3329	chmod 0500 $(INSTALLDIR)/openvpn/usr/sbin/openvpn
3330	install -D openvpn/src/plugins/auth-pam/.libs/openvpn-plugin-auth-pam.so $(INSTALLDIR)/openvpn/usr/lib/openvpn-plugin-auth-pam.so
3331	$(STRIP) -s $(INSTALLDIR)/openvpn/usr/lib/openvpn-plugin-auth-pam.so
3332	@mkdir -p $(TARGETDIR)/rom/easy-rsa
3333	install openvpn/easy-rsa/2.0/* $(TARGETDIR)/rom/easy-rsa
3334	install -D $</dh2048.pem $(INSTALLDIR)/openvpn/rom/dh2048.pem
3335
3336sdparm-1.02: sdparm-1.02/Makefile
3337	$(MAKE) -C $@
3338
3339sdparm-1.02/Makefile: sdparm-1.02/configure
3340	$(MAKE) sdparm-1.02-configure
3341
3342sdparm-1.02/configure:
3343	( cd sdparm-1.02 ; ./autogen.sh )
3344
3345sdparm-1.02-configure:
3346	( cd sdparm-1.02 ; \
3347		$(CONFIGURE) \
3348		--prefix=/usr \
3349		--bindir=/usr/bin \
3350		--libdir=/usr/lib \
3351	)
3352
3353sdparm-1.02-install: sdparm-1.02
3354	@[ ! -d sdparm-1.02 ] || install -D sdparm-1.02/src/sdparm $(INSTALLDIR)/sdparm-1.02/usr/bin/sdparm
3355	@$(STRIP) $(INSTALLDIR)/sdparm-1.02/usr/bin/sdparm
3356
3357sdparm-1.02-clean:
3358	[ ! -f sdparm-1.02/Makefile ] || $(MAKE) -C sdparm-1.02 distclean
3359	@rm -f sdparm-1.02/Makefile
3360
3361.PHONY: strace
3362strace: strace/Makefile
3363	$(MAKE) -C $@
3364
3365strace/Makefile: strace/configure
3366	$(MAKE) strace-configure
3367
3368strace/configure:
3369	( cd strace && autoreconf -i -f )
3370
3371strace-configure:
3372	( cd strace && $(CONFIGURE) --bindir=/sbin )
3373
3374strace-install:
3375	@install -D strace/strace $(INSTALLDIR)/strace/sbin/strace
3376	@$(STRIP) $(INSTALLDIR)/strace/sbin/strace
3377
3378strace-clean:
3379	[ ! -f strace/Makefile ] || $(MAKE) -C strace distclean
3380	@rm -f strace/Makefile
3381
3382.PHONY: termcap
3383termcap: termcap/Makefile
3384	$(MAKE) -C $@
3385
3386termcap/Makefile:
3387	( cd termcap && $(CONFIGURE) && touch termcap.info)
3388
3389termcap-install:
3390	# We don't need to install termcap to target filesystem.
3391
3392termcap-clean:
3393	[ ! -f termcap/Makefile ] || $(MAKE) -C termcap distclean
3394	@rm -f termcap/Makefile
3395
3396.PHONY: gdb
3397gdb: termcap gdb/Makefile
3398	$(MAKE) -C $@
3399
3400gdb/Makefile:
3401	( cd gdb && \
3402	  TUI_LIBRARY=$(TOP)/termcap/libtermcap.a \
3403	  LDFLAGS=-L$(TOP)/termcap \
3404	  CFLAGS_FOR_BUILD= \
3405	  $(CONFIGURE) --bindir=/sbin \
3406	)
3407
3408gdb-install:
3409	@install -D gdb/gdb/gdb $(INSTALLDIR)/gdb/sbin/gdb
3410	@install -D gdb/gdb/gdbserver/gdbserver $(INSTALLDIR)/gdb/sbin/gdbserver
3411	@$(STRIP) $(INSTALLDIR)/gdb/sbin/gdb
3412	@$(STRIP) $(INSTALLDIR)/gdb/sbin/gdbserver
3413
3414gdb-clean:
3415	[ ! -f gdb/Makefile ] || $(MAKE) -C gdb distclean
3416	@rm -f gdb/Makefile
3417
3418.PHONY: openlldp
3419openlldp: openlldp/Makefile
3420	$(MAKE) -C $@
3421
3422openlldp/Makefile:
3423	( cd openlldp && \
3424	  $(CONFIGURE) --bindir=/sbin \
3425	)
3426
3427openlldp-install:
3428	@install -D openlldp/src/lldpd $(INSTALLDIR)/openlldp/sbin/lldpd
3429	@$(STRIP) $(INSTALLDIR)/openlldp/sbin/lldpd
3430
3431openlldp-clean:
3432	[ ! -f openlldp/Makefile ] || $(MAKE) -C openlldp distclean
3433	@rm -f openlldp/Makefile
3434
3435
3436nas$(BCMEX)$(EX7): nvram$(BCMEX)
3437
3438hspot_ap$(BCMEX)$(EX7): shared nvram$(BCMEX)
3439	@echo "do nothing"
3440
3441hspot_ap$(BCMEX)$(EX7)-install:
3442	@echo "do nothing"
3443
3444eapd$(BCMEX)$(EX7)-clean:
3445	-@cd eapd$(BCMEX)$(EX7)/linux && make clean
3446
3447lighttpd-1.4.39/stamp-h1:
3448ifneq ($(RTCONFIG_QTN),y)
3449	cd lighttpd-1.4.39 && ./preconfigure-script touch $@
3450else
3451	cd lighttpd-1.4.39 && ./preconfigure-script-qtn touch $@
3452endif
3453
3454lighttpd-1.4.39: shared nvram$(BCMEX) libdisk samba-3.5.8 pcre-8.31 libxml2 sqlite libexif openssl lighttpd-1.4.39/stamp-h1
3455
3456lighttpd-1.4.39-install: lighttpd-1.4.39
3457	install -D lighttpd-1.4.39/src/.libs/lighttpd $(INSTALLDIR)/lighttpd-1.4.39/usr/sbin/lighttpd
3458	install -D lighttpd-1.4.39/src/.libs/lighttpd-monitor $(INSTALLDIR)/lighttpd-1.4.39/usr/sbin/lighttpd-monitor
3459	install -D lighttpd-1.4.39/src/.libs/lighttpd-arpping $(INSTALLDIR)/lighttpd-1.4.39/usr/sbin/lighttpd-arpping
3460	$(STRIP) -s $(INSTALLDIR)/lighttpd-1.4.39/usr/sbin/lighttpd
3461	$(STRIP) -s $(INSTALLDIR)/lighttpd-1.4.39/usr/sbin/lighttpd-monitor
3462	$(STRIP) -s $(INSTALLDIR)/lighttpd-1.4.39/usr/sbin/lighttpd-arpping
3463
3464	install -d $(INSTALLDIR)/lighttpd-1.4.39/usr/lib/
3465	install -D lighttpd-1.4.39/src/.libs/*.so $(INSTALLDIR)/lighttpd-1.4.39/usr/lib/
3466	install -D samba-3.5.8/source3/bin/libsmbclient.so.0 $(INSTALLDIR)/lighttpd-1.4.39/usr/lib/libsmbclient.so.0
3467	install -D sqlite/.libs/libsqlite3.so.0 $(INSTALLDIR)/lighttpd-1.4.39/usr/lib/libsqlite3.so.0
3468	install -D libexif/libexif/.libs/libexif.so.12 $(INSTALLDIR)/lighttpd-1.4.39/usr/lib/libexif.so.12
3469
3470	mkdir -p $(INSTALLDIR)/lighttpd-1.4.39/usr/lighttpd/css && mkdir -p $(INSTALLDIR)/lighttpd-1.4.39/usr/lighttpd/js
3471	cp -rf  lighttpd-1.4.39/external_file/css/ $(INSTALLDIR)/lighttpd-1.4.39/usr/lighttpd
3472	cp -rf  lighttpd-1.4.39/external_file/js/ $(INSTALLDIR)/lighttpd-1.4.39/usr/lighttpd
3473	cp -f APP-IPK/AiCloud-ipk/CONTROL/control $(INSTALLDIR)/lighttpd-1.4.39/usr/lighttpd
3474	cp -f APP-IPK/SmartSync-ipk/CONTROL/control $(INSTALLDIR)/lighttpd-1.4.39/usr/lighttpd/smartsync_control
3475
3476	$(STRIP) -s $(INSTALLDIR)/lighttpd-1.4.39/usr/lib/*.so
3477	$(STRIP) -s $(INSTALLDIR)/lighttpd-1.4.39/usr/lib/*.so.0
3478
3479lighttpd-1.4.39-clean:
3480	-@$(MAKE) -C lighttpd-1.4.39 clean
3481	@rm -f lighttpd-1.4.39/stamp-h1
3482
3483pcre-8.12/stamp-h1:
3484	cd pcre-8.12 && \
3485	CC=$(CC) CXX=$(CXX) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD) CFLAGS="-Os -Wall $(EXTRACFLAGS)" \
3486	./$(CONFIGURE) --prefix=/usr --disable-dependency-tracking
3487	touch $@
3488	[ -d pcre-8.12/m4 ] || mkdir pcre-8.12/m4
3489
3490pcre-8.12: pcre-8.12/stamp-h1
3491
3492pcre-8.12-install: pcre-8.12
3493	@$(SEP)
3494	install -D pcre-8.12/.libs/libpcre.so.0.0.1 $(INSTALLDIR)/pcre-8.12/usr/lib/libpcre.so.0
3495	$(STRIP) -s $(INSTALLDIR)/pcre-8.12/usr/lib/libpcre.so.0
3496
3497pcre-8.12-clean:
3498	-@$(MAKE) -C pcre-8.12 clean
3499	@rm -f pcre-8.12/stamp-h1
3500
3501pcre-8.31/stamp-h1:
3502	cd pcre-8.31 && \
3503	CC=$(CC) CXX=$(CXX) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD) CFLAGS="-Os -Wall $(EXTRACFLAGS)" LIBS="$(EXTRALDFLAGS)" \
3504	./$(CONFIGURE) --prefix=/usr --disable-dependency-tracking
3505	touch $@
3506	[ -d pcre-8.31/m4 ] || mkdir pcre-8.31/m4
3507
3508pcre-8.31: pcre-8.31/stamp-h1
3509
3510pcre-8.31-install: pcre-8.31
3511	@$(SEP)
3512	install -D pcre-8.31/.libs/libpcre.so.1.0.1 $(INSTALLDIR)/pcre-8.31/usr/lib/libpcre.so.1.0.1
3513	cd $(INSTALLDIR)/pcre-8.31/usr/lib && ln -sf libpcre.so.1.0.1 libpcre.so.1
3514	cd $(INSTALLDIR)/pcre-8.31/usr/lib && ln -sf libpcre.so.1.0.1 libpcre.so
3515	$(STRIP) -s $(INSTALLDIR)/pcre-8.31/usr/lib/libpcre.so.1.0.1
3516
3517pcre-8.31-clean:
3518	-@$(MAKE) -C pcre-8.31 clean
3519	@rm -f pcre-8.31/stamp-h1
3520
3521libxml2/stamp-h1:
3522	cd libxml2 && \
3523	CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD) CFLAGS="-Os -Wall $(EXTRACFLAGS)" LDFLAGS=-ldl \
3524	./$(CONFIGURE) --prefix=/usr --without-python --disable-dependency-tracking
3525	touch $@
3526
3527libxml2: libxml2/stamp-h1
3528	$(MAKE) -C libxml2 all
3529
3530libxml2-install: libxml2
3531	@$(SEP)
3532	install -D libxml2/.libs/libxml2.so.2 $(INSTALLDIR)/libxml2/usr/lib/libxml2.so.2
3533	$(STRIP) $(INSTALLDIR)/libxml2/usr/lib/libxml2.so.2
3534	cd $(INSTALLDIR)/libxml2/usr/lib && ln -sf libxml2.so.2 libxml2.so
3535
3536libxml2-clean:
3537	-@$(MAKE) -C libxml2 clean
3538	@rm -f libxml2/stamp-h1
3539
3540#libiconv-1.14
3541libiconv-1.14/stamp-h1:
3542	cd libiconv-1.14 && \
3543	$(CONFIGURE) CC=$(CC) --prefix=$(TOP)/libiconv-1.14/out
3544	touch $@
3545
3546libiconv-1.14:libiconv-1.14/stamp-h1
3547	@$(MAKE) -C libiconv-1.14
3548
3549libiconv-1.14-install: libiconv-1.14
3550	@$(SEP)
3551	install -D libiconv-1.14/lib/.libs/libiconv.so.2.5.1 $(INSTALLDIR)/libiconv-1.14/usr/lib/libiconv.so.2.5.1
3552	$(STRIP) $(INSTALLDIR)/libiconv-1.14/usr/lib/libiconv.so.2.5.1
3553	cd $(INSTALLDIR)/libiconv-1.14/usr/lib && ln -sf libiconv.so.2.5.1 libiconv.so && ln -sf libiconv.so.2.5.1 libiconv.so.2
3554
3555libiconv-1.14-clean:
3556	-@$(MAKE) -C libiconv-1.14 clean
3557	@rm -f libiconv-1.14/stamp-h1
3558
3559#ftpclient
3560ftpclient/stamp-h1: 
3561	@$(MAKE) -C ftpclient
3562
3563ftpclient:ftpclient/stamp-h1
3564
3565ftpclient-install: ftpclient
3566	@$(SEP)
3567	install -D ftpclient/ftpclient $(INSTALLDIR)/ftpclient/usr/sbin/ftpclient
3568	$(STRIP) $(INSTALLDIR)/ftpclient/usr/sbin/ftpclient
3569ifeq ($(RTCONFIG_BCMARM),y)
3570	install -D $(shell dirname $(shell which $(CXX)))/../arm-brcm-linux-uclibcgnueabi/lib/libstdc++.so.6 $(INSTALLDIR)/ftpclient/usr/lib/libstdc++.so.6
3571else
3572	install -D $(shell dirname $(shell which $(CXX)))/../lib/libstdc++.so.6 $(INSTALLDIR)/ftpclient/usr/lib/libstdc++.so.6
3573endif
3574
3575ftpclient-clean:
3576	-@$(MAKE) -C ftpclient clean
3577
3578#sambaclient
3579sambaclient/stamp-h1: 
3580	touch $@
3581
3582sambaclient: sambaclient/stamp-h1
3583	@$(MAKE) -C sambaclient
3584
3585sambaclient-install: sambaclient
3586	@$(SEP)
3587	install -D sambaclient/sambaclient $(INSTALLDIR)/sambaclient/usr/sbin/sambaclient
3588	$(STRIP) $(INSTALLDIR)/sambaclient/usr/sbin/sambaclient
3589ifeq ($(RTCONFIG_BCMARM),y)
3590	install -D $(shell dirname $(shell which $(CXX)))/../arm-brcm-linux-uclibcgnueabi/lib/libstdc++.so.6 $(INSTALLDIR)/sambaclient/usr/lib/libstdc++.so.6
3591else
3592	install -D $(shell dirname $(shell which $(CXX)))/../lib/libstdc++.so.6 $(INSTALLDIR)/sambaclient/usr/lib/libstdc++.so.6
3593endif
3594
3595sambaclient-clean:
3596	-@$(MAKE) -C sambaclient clean
3597	rm -rf sambaclient/stamp-h1
3598
3599#usbclient
3600usbclient/stamp-h1: 
3601	touch $@
3602
3603usbclient: usbclient/stamp-h1
3604	@$(MAKE) -C usbclient
3605
3606usbclient-install: usbclient
3607	@$(SEP)
3608	install -D usbclient/usbclient $(INSTALLDIR)/usbclient/usr/sbin/usbclient
3609	$(STRIP) $(INSTALLDIR)/usbclient/usr/sbin/usbclient
3610ifeq ($(RTCONFIG_BCMARM),y)
3611	install -D $(shell dirname $(shell which $(CXX)))/../arm-brcm-linux-uclibcgnueabi/lib/libstdc++.so.6 $(INSTALLDIR)/usbclient/usr/lib/libstdc++.so.6
3612else
3613	install -D $(shell dirname $(shell which $(CXX)))/../lib/libstdc++.so.6 $(INSTALLDIR)/usbclient/usr/lib/libstdc++.so.6
3614endif
3615
3616usbclient-clean:
3617	-@$(MAKE) -C usbclient clean
3618	rm -rf usbclient/stamp-h1
3619
3620#add by alan 
3621#add install neon 
3622neon/stamp-h1 neon/config.h:
3623	cd neon && \
3624	$(CONFIGURE) CC=$(CC) \
3625		--prefix=/usr \
3626		--bindir=/usr/sbin \
3627		--libdir=/usr/lib \
3628		--enable-shared --disable-static --disable-nls --with-zlib --with-ssl=openssl \
3629		--with-libs=$(TOP)/openssl:$(TOP)/libxml2 \
3630		CFLAGS='-I$(STAGEDIR)/usr/include -I$(TOP)/openssl/include' \
3631		LDFLAGS='-L$(TOP)/libxml2/.libs -L$(STAGEDIR)/usr/lib -L$(TOP)/openssl' \
3632		LIBS='-lxml2 -lssl -lcrypto -lpthread -ldl -lm' \
3633		XML2_CONFIG='$(TOP)/libxml2/xml2-config'
3634	cp -f neon/config.h neon/src/config.h
3635	touch $@
3636
3637neon: libxml2 neon/stamp-h1 neon/config.h
3638	$(MAKE) -C neon && $(MAKE) $@-stage
3639
3640neon-install: neon
3641	@$(SEP)
3642	install -D neon/src/.libs/libneon.so.27.2.6 $(INSTALLDIR)/neon/usr/lib/libneon.so.27.2.6
3643	$(STRIP) $(INSTALLDIR)/neon/usr/lib/libneon.so.27.2.6
3644	cd $(INSTALLDIR)/neon/usr/lib && ln -sf libneon.so.27.2.6 libneon.so && ln -sf libneon.so.27.2.6 libneon.so.27
3645
3646neon-clean:
3647	-@$(MAKE) -C neon clean
3648	@rm -f neon/stamp-h1
3649
3650neon-stage:
3651	@$(MAKE) -C neon install DESTDIR=$(STAGEDIR)
3652	@cp -f neon/src/webdav_base.h $(STAGEDIR)/usr/include
3653
3654#webdav_client
3655webdav_client/stamp-h1:
3656	touch $@
3657
3658webdav_client: webdav_client/stamp-h1 nvram$(BCMEX) zlib libxml2 neon
3659	@$(MAKE) -C webdav_client
3660
3661webdav_client-install: webdav_client
3662	@$(SEP)
3663	install -D webdav_client/webdav_client $(INSTALLDIR)/webdav_client/usr/sbin/webdav_client
3664	$(STRIP) $(INSTALLDIR)/webdav_client/usr/sbin/webdav_client
3665
3666webdav_client-clean:
3667	-@$(MAKE) -C webdav_client clean
3668	rm -rf webdav_client/stamp-h1
3669
3670#add by gauss
3671#add install libcurl
3672curl-7.21.7: curl-7.21.7/Makefile
3673	@$(MAKE) -C curl-7.21.7 && $(MAKE) $@-stage
3674
3675curl-7.21.7/Makefile:
3676	$(MAKE) curl-7.21.7-configure
3677
3678curl-7.21.7-configure:
3679	( cd curl-7.21.7 ; $(CONFIGURE) CC=$(CC) \
3680		--prefix=/usr --bindir=/usr/sbin --libdir=/usr/lib \
3681		--enable-http --with-ssl=$(TOP)/openssl LDFLAGS="-ldl" \
3682	)
3683
3684curl-7.21.7-install: curl-7.21.7
3685	@$(SEP)
3686	install -D curl-7.21.7/lib/.libs/libcurl.so.4.2.0 $(INSTALLDIR)/curl-7.21.7/usr/lib/libcurl.so.4.2.0
3687	$(STRIP) $(INSTALLDIR)/curl-7.21.7/usr/lib/libcurl.so.4.2.0
3688	cd $(INSTALLDIR)/curl-7.21.7/usr/lib && ln -sf libcurl.so.4.2.0 libcurl.so && ln -sf libcurl.so.4.2.0 libcurl.so.4
3689
3690curl-7.21.7-clean:
3691	[ ! -f curl-7.21.7/Makefile ] || $(MAKE) -C curl-7.21.7 clean
3692	@rm -f curl-7.21.7/Makefile
3693
3694#snmp with asus mib and openssl 1.0.0
3695net-snmp-5.7.2/stamp-h1:
3696	cd $(TOP)/net-snmp-5.7.2 && $(CONFIGURE) --prefix=$(INSTALLDIR)/net-snmp-5.7.2/usr --disable-embedded-perl --with-perl-modules=no --disable-debugging --enable-mini-agent --with-transports=UDP --without-kmem-usage --disable-applications --disable-mib-loading --disable-scripts --disable-mibs --disable-manuals --with-openssl=$(TOP)/openssl --with-ldflags="-L$(TOP)/openssl -L$(TOP)/nvram$(BCMEX) -L$(TOP)/shared -L$(TOP)/libnmp" --with-libs="-lnvram -lshared -lnmp $(EXTRA_FLAG)" --with-cflags="$(SNMPD_CFLAGS) -I$(TOP)/libnmp" --with-default-snmp-version="3" --with-sys-location=Unknown --with-logfile=/var/log/snmpd.log --with-persistent-directory=/var/net-snmp --with-sys-contact=root@localhost --enable-static=no --with-mib-modules="asus-mib/wireless,$(MIB_MODULE_PASSPOINT),asus-mib/lan,asus-mib/wan,asus-mib/ipv6,asus-mib/vpn,asus-mib/firewall,asus-mib/administration,asus-mib/systemLog,asus-mib/guestNetwork,asus-mib/trafficManager,asus-mib/parentalControl,asus-mib/quickInternetSetup"
3697	@touch net-snmp-5.7.2/stamp-h1
3698
3699net-snmp-5.7.2: net-snmp-5.7.2/stamp-h1
3700
3701net-snmp-5.7.2-install:
3702	@$(MAKE) -C net-snmp-5.7.2 install
3703
3704net-snmp-5.7.2-clean:
3705	@[ ! -f net-snmp-5.7.2/Makefile ] || $(MAKE) -C net-snmp-5.7.2 clean
3706	@rm -f net-snmp-5.7.2/stamp-h1
3707
3708asuswebstorage/stamp-h1:
3709	touch $@
3710
3711asuswebstorage: asuswebstorage/stamp-h1
3712	@$(MAKE) -C asuswebstorage
3713
3714asuswebstorage-install: asuswebstorage
3715	@$(SEP)
3716	install -D asuswebstorage/asuswebstorage $(INSTALLDIR)/asuswebstorage/usr/sbin/asuswebstorage
3717	$(STRIP) $(INSTALLDIR)/asuswebstorage/usr/sbin/asuswebstorage
3718
3719asuswebstorage-clean:
3720	-@$(MAKE) -C asuswebstorage clean
3721	rm -rf asuswebstorage/stamp-h1
3722
3723#dropbox_client
3724dropbox_client/stamp-h1:
3725	touch $@
3726
3727dropbox_client: dropbox_client/stamp-h1
3728	@$(MAKE) -C dropbox_client
3729
3730dropbox_client-install: dropbox_client
3731	@$(SEP)
3732	install -D dropbox_client/dropbox_client $(INSTALLDIR)/dropbox_client/usr/sbin/dropbox_client
3733	$(STRIP) $(INSTALLDIR)/dropbox_client/usr/sbin/dropbox_client
3734
3735dropbox_client-clean:
3736	-@$(MAKE) -C dropbox_client clean
3737	rm -rf dropbox_client/stamp-h1
3738
3739#inotify
3740inotify:
3741	@$(MAKE) -C inotify
3742
3743inotify-install: inotify
3744	@$(SEP)
3745	install -D inotify/inotify $(INSTALLDIR)/inotify/usr/sbin/inotify
3746	$(STRIP) $(INSTALLDIR)/inotify/usr/sbin/inotify
3747
3748inotify-clean:
3749	-@$(MAKE) -C inotify clean
3750
3751wl$(BCMEX)$(EX7):
3752	-@$(MAKE) -C wl$(BCMEX)$(EX7)
3753
3754wl$(BCMEX)$(EX7)-install:
3755	@$(SEP)
3756
3757rtl_bin:
3758	-@$(MAKE) -C rtl_bin
3759
3760rtl_bin-install:
3761	@$(SEP)
3762
3763#libgpg-error-1.10
3764libgpg-error-1.10/stamp-h1:
3765	cd $(TOP)/libgpg-error-1.10 && \
3766	$(CONFIGURE) --prefix=$(INSTALLDIR)/libgpg-error-1.10/usr
3767	touch $@
3768
3769libgpg-error-1.10: libgpg-error-1.10/stamp-h1
3770	@$(SEP)
3771	@$(MAKE) -C libgpg-error-1.10
3772
3773libgpg-error-1.10-install: libgpg-error-1.10
3774	install -D libgpg-error-1.10/src/.libs/libgpg-error.so.0.8.0 $(INSTALLDIR)/libgpg-error-1.10/usr/lib/libgpg-error.so.0.8.0
3775	$(STRIP) $(INSTALLDIR)/libgpg-error-1.10/usr/lib/libgpg-error.so.0.8.0
3776	cd $(INSTALLDIR)/libgpg-error-1.10/usr/lib && ln -sf libgpg-error.so.0.8.0 libgpg-error.so.0
3777
3778libgpg-error-1.10-clean:
3779	-@$(MAKE) -C libgpg-error-1.10 clean
3780	@rm -f libgpg-error-1.10/stamp-h1
3781
3782#libgcrypt-1.5.1
3783libgcrypt-1.5.1/stamp-h1: libgpg-error-1.10
3784	cd $(TOP)/libgcrypt-1.5.1 && \
3785	$(CONFIGURE) --prefix=$(INSTALLDIR)/libgcrypt-1.5.1/usr --with-gpg-error-prefix=$(TOP)/libgpg-error-1.10/src \
3786	LDFLAGS="-L$(TOP)/libgpg-error-1.10/src/.libs"
3787	touch $@
3788
3789libgcrypt-1.5.1: libgcrypt-1.5.1/stamp-h1
3790	@$(SEP)
3791	@$(MAKE) -C libgcrypt-1.5.1
3792
3793libgcrypt-1.5.1-install: libgcrypt-1.5.1
3794	install -D libgcrypt-1.5.1/src/.libs/libgcrypt.so.11.8.0 $(INSTALLDIR)/libgcrypt-1.5.1/usr/lib/libgcrypt.so.11.8.0
3795	$(STRIP) $(INSTALLDIR)/libgcrypt-1.5.1/usr/lib/libgcrypt.so.11.8.0
3796	cd $(INSTALLDIR)/libgcrypt-1.5.1/usr/lib && ln -sf libgcrypt.so.11.8.0 libgcrypt.so.11
3797
3798libgcrypt-1.5.1-clean:
3799	-@$(MAKE) -C libgcrypt-1.5.1 clean
3800	@rm -f libgcrypt-1.5.1/stamp-h1
3801
3802#db-4.8.30
3803db-4.8.30/build_unix/stamp-h1:
3804	cd $(TOP)/db-4.8.30/build_unix && \
3805	../dist/$(CONFIGURE) --prefix=$(INSTALLDIR)/db-4.8.30/usr \
3806	--enable-cxx CFLAGS="-Os" \
3807	--disable-cryptography \
3808	--disable-hash \
3809	--disable-queue \
3810	--disable-replication \
3811	--disable-statistics \
3812	--disable-verify \
3813	--disable-compat185 \
3814	--disable-cxx \
3815	--disable-diagnostic \
3816	--disable-dump185 \
3817	--disable-java \
3818	--disable-mingw \
3819	--disable-o_direct \
3820	--enable-posixmutexes \
3821	--disable-smallbuild \
3822	--disable-tcl \
3823	--disable-test \
3824	--disable-uimutexes \
3825	--enable-umrw \
3826	--disable-libtool-lock
3827	touch $@
3828
3829##	--enable-compat185 --enable-dbm --enable-cxx CFLAGS="-Os" --disable-mutexsupport
3830
3831db-4.8.30: db-4.8.30/build_unix/stamp-h1
3832	@$(SEP)
3833	@$(MAKE) -C db-4.8.30/build_unix
3834
3835db-4.8.30-install: db-4.8.30
3836	install -D db-4.8.30/build_unix/.libs/libdb-4.8.so $(INSTALLDIR)/db-4.8.30/usr/lib/libdb-4.8.so
3837	$(STRIP) $(INSTALLDIR)/db-4.8.30/usr/lib/libdb-4.8.so
3838	cd $(INSTALLDIR)/db-4.8.30/usr/lib && ln -sf libdb-4.8.so libdb.so
3839	cd $(INSTALLDIR)/db-4.8.30/usr/lib && ln -sf libdb-4.8.so libdb-4.so
3840
3841#	@$(MAKE) -C db-4.8.30/build_unix install
3842
3843db-4.8.30-clean:
3844	-@$(MAKE) -C db-4.8.30 clean
3845	-@$(MAKE) -C db-4.8.30/build_unix clean
3846	@rm -f db-4.8.30/build_unix/stamp-h1
3847
3848#netatalk-3.0.5
3849netatalk-3.0.5/stamp-h1: openssl libgcrypt-1.5.1 db-4.8.30
3850	touch $(TOP)/netatalk-3.0.5/*
3851	cd $(TOP)/netatalk-3.0.5 && \
3852	$(CONFIGURE) CPPFLAGS="-I$(TOP)/db-4.8.30/build_unix -I$(TOP)/libgcrypt-1.5.1/src" \
3853	LDFLAGS="-L$(TOP)/db-4.8.30/build_unix/.libs -L$(TOP)/libgcrypt-1.5.1/src/.libs" \
3854	LIBS="-L$(TOP)/libgpg-error-1.10/src/.libs -lgpg-error -L$(TOP)/libgcrypt-1.5.1/src/.libs -lgcrypt" \
3855	ac_cv_path_LIBGCRYPT_CONFIG=$(TOP)/libgcrypt-1.5.1/src/libgcrypt-config \
3856	--without-kerberos \
3857	--with-bdb=$(TOP)/db-4.8.30/build_unix \
3858	--prefix=$(INSTALLDIR)/netatalk-3.0.5/usr \
3859	--with-ssl-dir=$(TOP)/openssl \
3860	--with-libgcrypt-dir=$(TOP)/libgcrypt-1.5.1 \
3861	--with-ld-library-path=$(SRCBASE)/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/lib
3862	touch $@
3863
3864netatalk-3.0.5: netatalk-3.0.5/stamp-h1
3865	@$(SEP)
3866	@touch netatalk-3.0.5/configure
3867	@$(MAKE) -C netatalk-3.0.5
3868
3869netatalk-3.0.5-install: netatalk-3.0.5
3870	install -D netatalk-3.0.5/etc/afpd/.libs/afpd $(INSTALLDIR)/netatalk-3.0.5/usr/sbin/afpd
3871	install -D netatalk-3.0.5/etc/cnid_dbd/.libs/cnid_dbd $(INSTALLDIR)/netatalk-3.0.5/usr/sbin/cnid_dbd
3872	install -D netatalk-3.0.5/etc/cnid_dbd/.libs/cnid_metad $(INSTALLDIR)/netatalk-3.0.5/usr/sbin/cnid_metad
3873	install -D netatalk-3.0.5/bin/ad/.libs/ad $(INSTALLDIR)/netatalk-3.0.5/usr/bin/ad
3874	install -D netatalk-3.0.5/bin/afppasswd/.libs/afppasswd $(INSTALLDIR)/netatalk-3.0.5/usr/bin/afppasswd
3875	install -D netatalk-3.0.5/etc/cnid_dbd/.libs/dbd $(INSTALLDIR)/netatalk-3.0.5/usr/bin/dbd
3876	install -D netatalk-3.0.5/bin/uniconv/.libs/uniconv $(INSTALLDIR)/netatalk-3.0.5/usr/bin/uniconv
3877	install -D netatalk-3.0.5/libatalk/.libs/libatalk.so.6.0.0 $(INSTALLDIR)/netatalk-3.0.5/usr/lib/libatalk.so.6.0.0
3878	install -D netatalk-3.0.5/etc/uams/.libs/uams_randnum.so $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk/uams_randnum.so
3879	install -D netatalk-3.0.5/etc/uams/.libs/uams_passwd.so $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk/uams_passwd.so
3880	install -D netatalk-3.0.5/etc/uams/.libs/uams_guest.so $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk/uams_guest.so
3881	install -D netatalk-3.0.5/etc/uams/.libs/uams_dhx_passwd.so $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk/uams_dhx_passwd.so
3882	install -D netatalk-3.0.5/etc/uams/.libs/uams_dhx2_passwd.so $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk/uams_dhx2_passwd.so
3883	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/sbin/afpd
3884	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/sbin/cnid_dbd
3885	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/sbin/cnid_metad
3886	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/bin/ad
3887	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/bin/afppasswd
3888	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/bin/dbd
3889	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/bin/uniconv
3890	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/lib/libatalk.so.6.0.0
3891	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk/uams_randnum.so
3892	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk/uams_passwd.so
3893	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk/uams_guest.so
3894	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk/uams_dhx_passwd.so
3895	$(STRIP) $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk/uams_dhx2_passwd.so
3896	cd $(INSTALLDIR)/netatalk-3.0.5/usr/lib && ln -sf libatalk.so.6.0.0 libatalk.so.6
3897	cd $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk && ln -sf uams_passwd.so uams_clrtxt.so
3898	cd $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk && ln -sf uams_dhx_passwd.so uams_dhx.so
3899	cd $(INSTALLDIR)/netatalk-3.0.5/usr/lib/netatalk && ln -sf uams_dhx2_passwd.so uams_dhx2.so
3900
3901netatalk-3.0.5-clean:
3902	-@$(MAKE) -C netatalk-3.0.5 distclean
3903	@rm -f netatalk-3.0.5/stamp-h1
3904
3905#expat-2.0.1
3906expat-2.0.1/stamp-h1:
3907	cd $(TOP)/expat-2.0.1 && \
3908	$(CONFIGURE) --build=i686-linux --prefix=$(INSTALLDIR)/expat-2.0.1/usr
3909	touch $@
3910
3911expat-2.0.1: expat-2.0.1/stamp-h1
3912	@$(SEP)
3913	@$(MAKE) -C expat-2.0.1 && $(MAKE) $@-stage
3914
3915expat-2.0.1-install: expat-2.0.1
3916	install -D expat-2.0.1/.libs/libexpat.so.1.5.2 $(INSTALLDIR)/expat-2.0.1/usr/lib/libexpat.so.1.5.2
3917	$(STRIP) $(INSTALLDIR)/expat-2.0.1/usr/lib/libexpat.so.1.5.2
3918	cd $(INSTALLDIR)/expat-2.0.1/usr/lib && ln -sf libexpat.so.1.5.2 libexpat.so.1
3919
3920expat-2.0.1-clean:
3921	-@$(MAKE) -C expat-2.0.1 clean
3922	@rm -f expat-2.0.1/stamp-h1
3923
3924#avahi-0.6.31
3925avahi-0.6.31: shared nvram$(BCMEX) expat-2.0.1 libdaemon avahi-0.6.31/Makefile
3926	@$(SEP)
3927	@$(MAKE) -C avahi-0.6.31
3928
3929avahi-0.6.31/Makefile:
3930	$(MAKE) avahi-0.6.31-configure
3931
3932avahi-0.6.31-configure:
3933	( cd avahi-0.6.31 ; $(CONFIGURE) LDFLAGS="-L$(TOP)/expat-2.0.1/.libs -ldl -lpthread" \
3934		CFLAGS="$(CFLAGS) -I$(TOP)/expat-2.0.1/lib -I$(TOP)/shared -I$(SRCBASE)/include" \
3935		--prefix=$(INSTALLDIR)/avahi-0.6.31/usr --with-distro=archlinux \
3936		--disable-glib --disable-gobject --disable-qt3 --disable-qt4 --disable-gtk \
3937		--disable-dbus --disable-expat --disable-gdbm --disable-python \
3938		--disable-pygtk --disable-python-dbus --disable-mono --disable-monodoc \
3939		--disable-gtk3 --with-xml=none \
3940		LIBDAEMON_LIBS="-L$(TOP)/libdaemon/libdaemon/.libs -ldaemon -L$(TOP)/nvram$(BCMEX) -lnvram -L$(TOP)/shared -lshared $(if $(RTCONFIG_QTN),-L$(TOP)/libqcsapi_client -lqcsapi_client)" \
3941		LIBDAEMON_CFLAGS="-I$(TOP)/libdaemon" --disable-autoipd --with-xml=expat --disable-stack-protector --with-avahi-user="admin" --with-avahi-group="root" \
3942	)
3943
3944avahi-0.6.31-install: avahi-0.6.31
3945	install -D avahi-0.6.31/avahi-daemon/.libs/avahi-daemon $(INSTALLDIR)/avahi-0.6.31/usr/sbin/avahi-daemon
3946	install -D avahi-0.6.31/avahi-common/.libs/libavahi-common.so.3.5.3 $(INSTALLDIR)/avahi-0.6.31/usr/lib/libavahi-common.so.3.5.3
3947	install -D avahi-0.6.31/avahi-core/.libs/libavahi-core.so.7.0.2 $(INSTALLDIR)/avahi-0.6.31/usr/lib/libavahi-core.so.7.0.2
3948	$(STRIP) $(INSTALLDIR)/avahi-0.6.31/usr/sbin/avahi-daemon
3949	$(STRIP) $(INSTALLDIR)/avahi-0.6.31/usr/lib/libavahi-common.so.3.5.3
3950	$(STRIP) $(INSTALLDIR)/avahi-0.6.31/usr/lib/libavahi-core.so.7.0.2
3951	cd $(INSTALLDIR)/avahi-0.6.31/usr/lib && ln -sf libavahi-common.so.3.5.3 libavahi-common.so.3
3952	cd $(INSTALLDIR)/avahi-0.6.31/usr/lib && ln -sf libavahi-core.so.7.0.2 libavahi-core.so.7
3953
3954avahi-0.6.31-clean:
3955	[ ! -f avahi-0.6.31/Makefile ] || $(MAKE) -C avahi-0.6.31 clean
3956	@rm -f avahi-0.6.31/Makefile
3957
3958madwimax-0.1.1/stamp-h1:
3959	cd $(TOP)/madwimax-0.1.1 && \
3960	LDFLAGS="$(LDFLAGS) -ldl" $(CONFIGURE) --prefix=$(TOP)/madwimax-0.1.1/build --with-script=wl500g --without-man-pages --with-udev-dir=$(TOP)/madwimax-0.1.1/build libusb1_CFLAGS=-I$(TOP)/libusb10/libusb libusb1_LIBS="-L$(TOP)/libusb10/libusb/.libs -lusb-1.0"
3961	touch $@
3962
3963madwimax-0.1.1: libusb10 madwimax-0.1.1/stamp-h1
3964	@$(SEP)
3965	@$(MAKE) -C madwimax-0.1.1 all
3966
3967madwimax-0.1.1-install: madwimax-0.1.1
3968	#install -D madwimax-0.1.1/scripts/events/event.sh $(INSTALLDIR)/madwimax-0.1.1/usr/sbin/event.sh
3969	install -D madwimax-0.1.1/src/madwimax $(INSTALLDIR)/madwimax-0.1.1/usr/sbin/madwimax
3970	$(STRIP) $(INSTALLDIR)/madwimax-0.1.1/usr/sbin/madwimax
3971
3972madwimax-0.1.1-clean:
3973	-@$(MAKE) -C madwimax-0.1.1 clean
3974	@cd $(TOP)/madwimax-0.1.1 && rm -f config.log config.status
3975	@cd $(TOP)/madwimax-0.1.1 && rm -f `find -name Makefile`
3976	@cd $(TOP)/madwimax-0.1.1 && rm -rf include/config.h scripts/udev/z60_madwimax.rules src/.deps
3977	@rm -f madwimax-0.1.1/stamp-h1
3978
3979ufsd: kernel_header kernel
3980	@$(MAKE) -C ufsd all
3981
3982ufsd-install: ufsd
3983	@$(MAKE) -C ufsd install INSTALLDIR=$(INSTALLDIR)/ufsd
3984
3985netstat-nat-clean:
3986	-@$(MAKE) -C netstat-nat clean
3987	@rm -f netstat-nat/Makefile
3988	@rm -f netstat-nat/stamp-h1
3989
3990netstat-nat-install: netstat-nat
3991	install -D netstat-nat/netstat-nat $(INSTALLDIR)/netstat-nat/usr/sbin/netstat-nat
3992	$(STRIP) -s $(INSTALLDIR)/netstat-nat/usr/sbin/netstat-nat
3993
3994netstat-nat/stamp-h1:
3995	cd netstat-nat && \
3996	CC=$(CC) CFLAGS="-Os -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections" \
3997		LDFLAGS="-ffunction-sections -fdata-sections -Wl,--gc-sections -fPIC" \
3998		$(CONFIGURE)
3999	@touch $@
4000
4001netstat-nat: netstat-nat/stamp-h1
4002
4003netstat-nat: netstat-nat/Makefile
4004	$(MAKE) -C netstat-nat
4005
4006tftp:
4007	cd tftp && CC=$(CC) && $(MAKE)
4008
4009tftp-clean:
4010	cd tftp && $(MAKE) clean
4011
4012tftp-install:
4013	# TPTP server
4014	install -D tftp/tftpd $(INSTALLDIR)/tftp/usr/sbin/tftpd
4015	$(STRIP) -s $(INSTALLDIR)/tftp/usr/sbin/tftpd
4016	# TFTP client
4017	#install -D tftp/tftpc $(INSTALLDIR)/tftp/usr/sbin/tftpc
4018	#$(STRIP) -s $(INSTALLDIR)/tftp/usr/sbin/tftpc
4019
4020bwdpi: nvram$(BCMEX)
4021	cd bwdpi && CC=$(CC) && $(MAKE)
4022
4023bwdpi_sqlite: bwdpi sqlite
4024	cd bwdpi_sqlite && CC=$(CC) && $(MAKE)
4025
4026bwdpi_sqlite-clean:
4027	cd bwdpi_sqlite && $(MAKE) clean
4028
4029bwdpi_sqlite-install: bwdpi_sqlite
4030
4031traffic_limiter: sqlite
4032	cd traffic_limiter && CC=$(CC) && $(MAKE)
4033
4034traffic_limiter-clean:
4035	cd traffic_limiter && $(MAKE) clean
4036
4037traffic_limiter-install: traffic_limiter
4038
4039NORTON_DIR := $(SRCBASE)/router/norton${BCMEX}
4040
4041.PHONY: norton${BCMEX} norton${BCMEX}-install norton${BCMEX}-clean
4042
4043
4044norton${BCMEX}:
4045	+$(MAKE) -C $(NORTON_DIR)
4046
4047norton${BCMEX}-install:
4048	+$(MAKE) -C $(NORTON_DIR) install INSTALLDIR=$(INSTALLDIR)/norton${BCMEX}
4049
4050norton${BCMEX}-clean:
4051	[ ! -f $(NORTEON_DIR)/Makefile ] || -@$(MAKE) -C $(NORTON_DIR) clean
4052
4053.PHONY : email-3.1.3 email-3.1.3-clean
4054
4055ifeq ($(RTCONFIG_NOTIFICATION_CENTER),y)
4056email-3.1.3/stamp-h1: openssl
4057	cd $(TOP)/email-3.1.3 && \
4058	$(CONFIGURE) --with-ssl --sysconfdir=/etc \
4059		CFLAGS="-I$(SRCBASE)/router/openssl/include -I$(TOP)/nt_center/lib -I$(TOP)/sqlite -DRTCONFIG_NOTIFICATION_CENTER" \
4060		LDFLAGS="-L$(SRCBASE)/router/openssl -L$(TOP)/nt_center/lib -L$(TOP)/sqlite/.libs" \
4061		LIBS="-lnt -lsqlite3 -lpthread -lcrypto -lssl $(if $(RTCONFIG_QCA), -ldl)"
4062	touch $@
4063else
4064email-3.1.3/stamp-h1: openssl
4065	cd $(TOP)/email-3.1.3 && \
4066	$(CONFIGURE) --with-ssl --sysconfdir=/etc \
4067		CFLAGS=-I$(SRCBASE)/router/openssl/include \
4068		LDFLAGS="-L$(SRCBASE)/router/openssl" \
4069		LIBS="-lcrypto -lssl $(if $(RTCONFIG_QCA), -ldl)"
4070	touch $@
4071endif
4072
4073email-3.1.3: email-3.1.3/stamp-h1
4074	$(MAKE) -C email-3.1.3
4075
4076email-3.1.3-clean:
4077	-@$(MAKE) -C email-3.1.3 clean
4078	@rm -f email-3.1.3/stamp-h1
4079
4080email-3.1.3-install: email-3.1.3
4081	install -D email-3.1.3/src/email $(INSTALLDIR)/email-3.1.3/usr/sbin/email
4082	$(STRIP) $(INSTALLDIR)/email-3.1.3/usr/sbin/email
4083
4084#diskdev_cmds-332.14
4085diskdev_cmds-332.14:
4086	@$(SEP)
4087	cd $(TOP)/diskdev_cmds-332.14 && \
4088	make -f Makefile.lnx
4089
4090diskdev_cmds-332.14-install: diskdev_cmds-332.14
4091	install -D diskdev_cmds-332.14/newfs_hfs.tproj/newfs_hfs $(INSTALLDIR)/diskdev_cmds-332.14/usr/sbin/mkfs.hfsplus
4092	install -D diskdev_cmds-332.14/fsck_hfs.tproj/fsck_hfs $(INSTALLDIR)/diskdev_cmds-332.14/usr/sbin/fsck.hfsplus
4093	$(STRIP) $(INSTALLDIR)/diskdev_cmds-332.14/usr/sbin/mkfs.hfsplus
4094	$(STRIP) $(INSTALLDIR)/diskdev_cmds-332.14/usr/sbin/fsck.hfsplus
4095	cd $(INSTALLDIR)/diskdev_cmds-332.14/usr/sbin && \
4096	rm -f mkfs.hfs && \
4097	rm -f fsck.hfs && \
4098	ln -s mkfs.hfsplus mkfs.hfs && \
4099	ln -s fsck.hfsplus fsck.hfs
4100
4101diskdev_cmds-332.14-clean:
4102	cd $(TOP)/diskdev_cmds-332.14 && \
4103	make -f Makefile.lnx clean
4104	rm -f $(INSTALLDIR)/diskdev_cmds-332.14/usr/sbin/mkfs.hfs 
4105	rm -f $(INSTALLDIR)/diskdev_cmds-332.14/usr/sbin/fsck.hfs 
4106
4107GeoIP-1.6.2/stamp-h1:
4108	cd GeoIP-1.6.2 && autoreconf -i -f && $(CONFIGURE) \
4109	--bindir=/sbin ac_cv_func_malloc_0_nonnull=yes \
4110	ac_cv_func_realloc_0_nonnull=yes --disable-dependency-tracking \
4111	--datadir=/usr/share
4112	touch $@
4113
4114GeoIP-1.6.2: GeoIP-1.6.2/stamp-h1
4115	$(MAKE) -C $@
4116
4117GeoIP-1.6.2-configure:
4118	( cd GeoIP-1.6.2 && $(CONFIGURE) \
4119	--bindir=/sbin ac_cv_func_malloc_0_nonnull=yes \
4120	ac_cv_func_realloc_0_nonnull=yes --disable-dependency-tracking \
4121	--datadir=/usr/share)
4122
4123GeoIP-1.6.2-install: GeoIP-1.6.2
4124#	install -D GeoIP-1.6.2/apps/.libs/geoiplookup $(INSTALLDIR)/GeoIP-1.6.2/usr/sbin/geoiplookup
4125	install -D GeoIP-1.6.2/data/GeoIP.dat $(INSTALLDIR)/GeoIP-1.6.2/usr/share/GeoIP/GeoIP.dat
4126	install -D GeoIP-1.6.2/libGeoIP/.libs/libGeoIP.so.1.6.2 $(INSTALLDIR)/GeoIP-1.6.2/usr/lib/libGeoIP.so.1.6.2
4127#	$(STRIP) $(INSTALLDIR)/GeoIP-1.6.2/usr/sbin/geoiplookup
4128	$(STRIP) $(INSTALLDIR)/GeoIP-1.6.2/usr/lib/*.so.*
4129	cd $(INSTALLDIR)/GeoIP-1.6.2/usr/lib && \
4130		ln -sf libGeoIP.so.1.6.2 libGeoIP.so && \
4131		ln -sf libGeoIP.so.1.6.2 libGeoIP.so.1
4132
4133GeoIP-1.6.2-clean:
4134	-@[ ! -f GeoIP-1.6.2/Makefile ] || $(MAKE) -C GeoIP-1.6.2 distclean
4135	@rm -f GeoIP-1.6.2/stamp-h1
4136
4137Transmission/configure:
4138	cd Transmission && ./autogen.sh
4139
4140Transmission/Makefile: Transmission/configure
4141	( cd Transmission ; $(CONFIGURE) --prefix=/usr --bindir=/usr/sbin --libdir=/usr/lib \
4142		CFLAGS="$(CFLAGS) -I$(STAGEDIR)/usr/include" \
4143		LDFLAGS="$(LDFLAGS) -L$(STAGEDIR)/usr/lib" \
4144		--disable-nls --disable-gtk \
4145	)
4146
4147Transmission: curl-7.21.7 libevent-2.0.21 Transmission/Makefile
4148	@$(SEP)
4149	$(MAKE) -C $@
4150
4151Transmission-install: Transmission
4152	install -D $</daemon/transmission-daemon $(INSTALLDIR)/$</usr/sbin/transmission-daemon
4153	$(STRIP) $(INSTALLDIR)/$</usr/sbin/*
4154
4155Transmission-clean:
4156	[ ! -f Transmission/Makefile ] || $(MAKE) -C Transmission KERNEL_DIR=$(LINUXDIR) distclean
4157	@rm -f Transmission/Makefile
4158
4159wget/Makefile:
4160	cd wget && autoreconf -i -f && $(CONFIGURE) --with-ssl=openssl --with-libssl-prefix=$(TOP)/openssl --disable-opie --disable-ntlm --disable-debug --disable-nls --disable-iri --disable-dependency-tracking CFLAGS="$(EXTRACFLAGS) -I$(TOP)/openssl/include -I$(TOP)/zlib" LDFLAGS="-L$(TOP)/openssl -lssl -lcrypto -L$(TOP)/zlib -lz"
4161
4162wget: openssl zlib wget/Makefile
4163	$(MAKE) -C wget CFLAGS="-Os -Wall $(EXTRACFLAGS) -ffunction-sections -fdata-sections -Wl,--gc-sections -I$(TOP)/openssl/include -I$(TOP)/zlib"
4164
4165wget-clean:
4166	[ ! -f wget/Makefile ] || $(MAKE) -C wget distclean
4167	@rm -f wget/Makefile
4168
4169wget-install:
4170	install -D wget/src/wget $(INSTALLDIR)/wget/usr/sbin/wget
4171	$(STRIP) $(INSTALLDIR)/wget/usr/sbin/wget
4172
4173qca-wifi:
4174	$(MAKE) -C $@ TARGET_CROSS=$(CROSS_COMPILE) LINUX_KARCH=$(ARCH) LINUX_VERSION=$(LINUX_KERNEL) LINUX_DIR=$(LINUXDIR) && $(MAKE) $@-stage
4175
4176qca-wifi-install: qca-wifi
4177	$(MAKE) -C $< INSTALLDIR=$(INSTALLDIR)/$< LINUX_VERSION=$(LINUX_KERNEL) install
4178
4179qca-wifi-clean:
4180	$(MAKE) -C qca-wifi clean KERNELPATH=$(LINUXDIR)
4181	$(RM) -f qca-wifi/lsdk_flags
4182
4183qca-wifi-stage:
4184	$(MAKE) -C qca-wifi stage
4185
4186qca-hostap: qca-wifi
4187	$(MAKE) -C $@
4188
4189LinuxART2-install: LinuxART2
4190ifneq ($(ART2_INSTALLDIR),)
4191	$(MAKE) -C $< install INSTALLDIR=$(ART2_INSTALLDIR)/$<
4192else
4193	$(MAKE) -C $< install INSTALLDIR=$(INSTALLDIR)/$<
4194endif
4195
4196stage-tags: dummy
4197	ctags -aR -f $(SRCBASE)/tags $(STAGEDIR)/usr/include
4198
4199sysstat-10.0.3-install:
4200	$(MAKE) -C sysstat-10.0.3 install_base DESTDIR=$(INSTALLDIR)/sysstat-10.0.3 INSTALL_DOC=n
4201	mv $(INSTALLDIR)/sysstat-10.0.3/etc $(INSTALLDIR)/sysstat-10.0.3/etc_sysstat
4202	rm -rf $(INSTALLDIR)/sysstat-10.0.3/var
4203#
4204# tunnel related 
4205#
4206
4207asusnatnl: openssl
4208	$(MAKE) -C $@
4209
4210asusnatnl-clean:
4211	$(MAKE) -C asusnatnl clean
4212
4213asusnatnl-install: asusnatnl
4214	install -d $(INSTALLDIR)/asusnatnl/usr/lib/
4215	install -D asusnatnl/natnl/libasusnatnl.so $(INSTALLDIR)/asusnatnl/usr/lib/libasusnatnl.so
4216	$(STRIP) -s $(INSTALLDIR)/asusnatnl/usr/lib/libasusnatnl.so
4217
4218mastiff: shared nvram${BCMEX} wb
4219	cd aaews && \
4220        CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD) CFLAGS="-Os -Wall $(EXTRACFLAGS)" \
4221        make mastiff
4222
4223mastiff-install:
4224	install -d $(INSTALLDIR)/wb/usr/lib/
4225	install -D aaews/mastiff $(INSTALLDIR)/wb/usr/sbin/mastiff
4226	$(STRIP) -s $(INSTALLDIR)/wb/usr/sbin/mastiff
4227
4228mastiff-clean:
4229	cd aaews && make clean 
4230	echo $(INSTALLDIR)
4231
4232
4233#aaews: wb
4234
4235#wb: shared nvram curl-7.21.7 openssl libxml2 asusnatnl 
4236aaews: wb
4237	cd aaews && \
4238        CC=$(CC) CXX=$(CXX) AR=$(AR) RANLIB=$(RANLIB) LD=$(LD) CFLAGS="-Os -Wall $(EXTRACFLAGS)" \
4239        make router 
4240#make static-lib && \
4241
4242#$(MAKE)
4243#CC=mipsel-uclibc-g++ AR=$(AR) RANLIB=$(RANLIB) LD=$(LD) CFLAGS="-Os -Wall $(EXTRACFLAGS)" \
4244
4245aaews-install:
4246	install -d $(INSTALLDIR)/wb/usr/lib/
4247	install -D wb/libws.so $(INSTALLDIR)/wb/usr/lib/libws.so
4248	$(STRIP) -s $(INSTALLDIR)/wb/usr/lib/libws.so
4249	install -D aaews/aaews $(INSTALLDIR)/wb/usr/sbin/aaews
4250	$(STRIP) -s $(INSTALLDIR)/wb/usr/sbin/aaews
4251ifeq ($(RTCONFIG_BCMARM),y)
4252	install -D $(shell dirname $(shell which $(CXX)))/../arm-brcm-linux-uclibcgnueabi/lib/libstdc++.so.6 $(INSTALLDIR)/wb/usr/lib/libstdc++.so.6
4253else
4254	install -D $(shell dirname $(shell which $(CXX)))/../lib/libstdc++.so.6 $(INSTALLDIR)/wb/usr/lib/libstdc++.so.6
4255endif
4256
4257aaews-clean:
4258	cd aaews && make clean
4259
4260#json-c-0.12
4261json-c/stamp-h1:
4262	cd $(TOP)/json-c && \
4263	$(CONFIGURE) --enable-shared --disable-static \
4264	ac_cv_func_realloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes \
4265	CFLAGS="-Os -Wno-error $(EXTRACFLAGS)" \
4266	LDFLAGS="$(EXTRALDFLAGS)"
4267	touch $@
4268
4269json-c: json-c/stamp-h1
4270	$(MAKE) -C $@
4271
4272json-c-install: json-c
4273	install -D json-c/.libs/libjson-c.so.2.0.1 $(INSTALLDIR)/json-c/usr/lib/libjson-c.so.2.0.1
4274	$(STRIP) $(INSTALLDIR)/json-c/usr/lib/libjson-c.so.2.0.1
4275	cd $(INSTALLDIR)/json-c/usr/lib && ln -sf libjson-c.so.2.0.1 libjson-c.so
4276	cd $(INSTALLDIR)/json-c/usr/lib && ln -sf libjson-c.so.2.0.1 libjson-c.so.2
4277
4278json-c-clean:
4279	-@[ ! -f json-c/Makefile ] || $(MAKE) -C json-c clean
4280	-@rm -f json-c/stamp-h1
4281
4282phddns/stamp-h1:
4283	cd phddns && $(CONFIGURE) --prefix="" \
4284		CFLAGS="-Os -I$(SRCBASE)/include -I$(TOP)/shared $(EXTRACFLAGS)" \
4285		LDFLAGS="-L$(TOP)/nvram$(BCMEX) -L$(TOP)/shared $(if $(RTCONFIG_QTN),-L$(TOP)/libqcsapi_client) $(EXTRALDFLAGS)" \
4286		LIBS="-lnvram -lshared $(if $(RTCONFIG_QTN),-lqcsapi_client)"
4287	@touch $@
4288
4289phddns: phddns/stamp-h1
4290	$(MAKE) -C phddns
4291
4292phddns-install: phddns
4293	install -D phddns/src/phddns $(INSTALLDIR)/phddns/usr/sbin/phddns
4294	$(STRIP) $(INSTALLDIR)/phddns/usr/sbin/phddns
4295
4296phddns-clean:
4297	@[ ! -f phddns/Makefile ] || $(MAKE) -C phddns clean
4298	@rm -f phddns/stamp-h1
4299
4300#
4301# Generic rules
4302#
4303
4304%:
4305	@[ ! -d $* ] || [ -f $*/Makefile ] || $(MAKE) $*-configure
4306	@[ ! -d $* ] || ( $(SEP); $(MAKE) -C $* )
4307
4308
4309%-clean:
4310	-@[ ! -d $* ] || $(MAKE) -C $* clean
4311
4312%-install: %
4313	@echo $*
4314	@[ ! -d $* ] || $(MAKE) -C $* install INSTALLDIR=$(INSTALLDIR)/$*
4315
4316%-stage:
4317	@echo $*
4318	@[ ! -d $* ] || $(MAKE) -C $* install DESTDIR=$(STAGEDIR)
4319
4320%-build:
4321	$(MAKE) $*-clean $*
4322
4323%/Makefile:
4324	[ ! -d $* ] || $(MAKE) $*-configure
4325
4326%-configure:
4327	@[ ! -d $* ] || ( cd $* ; \
4328		$(CONFIGURE) \
4329		--prefix=/usr \
4330		--bindir=/usr/sbin \
4331		--libdir=/usr/lib \
4332	)
4333
4334
4335$(obj-y) $(obj-n) $(obj-clean) $(obj-install): dummy
4336
4337.PHONY: all clean distclean mrproper install package image
4338.PHONY: conf mconf oldconf kconf kmconf config menuconfig oldconfig
4339.PHONY: dummy libnet libpcap
4340
4341
4342