1include ../common.mak
2
3#BUILD_READMEM=y
4
5CFLAGS += -Wall -Os $(EXTRACFLAGS)
6CFLAGS += -I. -I$(TOP)/shared -I$(SRCBASE)/include -idirafter$(LINUXDIR)/include
7CFLAGS += -I$(TOP)/openssl/include
8CFLAGS += -I$(TOP)/push_log
9ifeq ($(RTCONFIG_DPSTA),y)
10CFLAGS += -I$(TOP)/dpsta
11endif
12CFLAGS += -ffunction-sections -fdata-sections
13CFLAGS += -DDLM -DASUS_DDNS -DASUS_EXT -DBTN_SETUP -DWEB_REDIRECT
14
15CFLAGS += -DDEBUG_RCTEST
16CFLAGS += -DQCA_WIFI_INS_RM
17
18ifeq ($(RTCONFIG_WPS),y)
19CFLAGS += -I$(SRCBASE)/wps/brcm_apps/include
20endif
21
22ifeq ($(RTCONFIG_RALINK),y)
23CFLAGS += -I$(TOP)/shared/sysdeps/ralink -I$(TOP)/wireless_tools
24ifneq ($(findstring MAC_REPEATER=, $(shell cat $(LINUXDIR)/.config)),)
25export CFLAGS += -DMAC_REPEATER
26endif
27ifneq ($(findstring CONFIG_RT2860V2_AP_EDCCA_MONITOR=, $(shell cat $(LINUXDIR)/.config)),)
28export CFLAGS += -DCE_ADAPTIVITY
29endif
30endif
31
32ifeq ($(RTCONFIG_QCA),y)
33CFLAGS += -I$(TOP)/shared/sysdeps/qca -I$(TOP)/wireless_tools
34endif
35
36include $(SRCBASE)/.config
37
38LDFLAGS = -L$(TOP)/nvram${BCMEX} -lnvram -L$(TOP)/shared -lshared -lcrypt -L$(TOP)/libbcmcrypto -lbcmcrypto -ldl
39
40ifeq ($(RTCONFIG_BCMARM),y)
41CFLAGS += -I$(SRCBASE)/shared/bcmwifi/include -DTYPEDEF_FLOAT_T
42CFLAGS += -I$(SRCBASE)/common/include
43ifneq ($(findstring CONFIG_DUMP_PREV_OOPS_MSG=, $(shell cat $(LINUXDIR)/.config)),)
44CFLAGS += -DDUMP_PREV_OOPS_MSG
45endif
46LDFLAGS += -L$(TOP)/libbcm -lbcm
47LDFLAGS += -lgcc_s
48ifeq ($(RTCONFIG_QTN),y)
49CFLAGS += -I$(TOP)/libqcsapi_client -I$(TOP)/shared/sysdeps/qtn
50LDFLAGS += -L$(TOP)/libqcsapi_client -lqcsapi_client
51endif
52endif
53
54ifeq ($(RTCONFIG_HTTPS),y)
55CFLAGS += -I$(TOP)/openssl/include/openssl
56LDFLAGS += -L$(TOP)/openssl -lcrypto -lssl
57endif
58
59ifeq ($(RTCONFIG_BWDPI),y)
60CFLAGS += -I$(TOP)/bwdpi/
61CFLAGS += -I$(TOP)/httpd/
62CFLAGS += -I$(TOP)/util-linux/include
63LDFLAGS += -L$(TOP)/bwdpi -lbwdpi
64endif
65
66ifeq ($(RTCONFIG_SPEEDTEST),y)
67LDFLAGS += -lm
68LDFLAGS += -lpthread
69endif
70
71ifeq ($(RTCONFIG_BCMSMP),y)
72CFLAGS += -DSMP
73endif
74
75ifeq ($(RTCONFIG_4352_5G),y)
76CFLAGS += -DBCM4352
77endif
78
79ifeq ($(RTCONFIG_USB),y)
80CFLAGS += -I$(TOP)/libdisk
81CFLAGS += -DU2EC
82LDFLAGS += -L$(TOP)/libdisk -ldisk
83ifeq ($(BCM_MMC),y)
84CFLAGS += -DBCM_MMC
85endif
86endif
87
88ifeq ($(RTCONFIG_USB_MODEM),y)
89CFLAGS += -DSET_USB_MODEM_MTU_ETH
90CFLAGS += -DSET_USB_MODEM_MTU_PPP
91endif
92
93ifeq ($(RTCONFIG_PUSH_EMAIL),y)
94LDFLAGS += -L$(TOP)/openssl -lcrypto -lssl
95LDFLAGS += -L$(TOP)/curl-7.21.7/lib/.libs -lcurl
96LDFLAGS += -L$(TOP)/libxml2/.libs -lxml2
97LDFLAGS += -L$(TOP)/wb -lws
98LDFLAGS += -L$(TOP)/push_log -lpush_log
99endif
100
101ifeq ($(RTCONFIG_NOTIFICATION_CENTER),y)
102CFLAGS  += -I$(TOP)/sqlite
103CFLAGS  += -I$(TOP)/nt_center/lib
104CFLAGS  += -DASUSWRT_SDK
105endif
106
107#CFLAGS += -DRC_BUILDTIME=$(shell date -d "now" +"%s")
108
109ifneq ($(findstring NET_CLS_POLICE=, $(shell cat $(LINUXDIR)/.config)),)
110else
111ifneq ($(findstring IMQ=, $(shell cat $(LINUXDIR)/.config)),)
112export CFLAGS += -DCLS_ACT
113endif
114endif
115
116ifneq ($(findstring DEVTMPFS=, $(shell cat $(LINUXDIR)/.config)),)
117export CFLAGS += -DDEVTMPFS
118endif
119
120ifeq ($(RA_SKU),y)
121export CFLAGS += -DRA_SINGLE_SKU
122endif
123
124LDFLAGS += -ffunction-sections -fdata-sections -Wl,--gc-sections
125ifeq ($(STATIC),1)
126LDFLAGS += -static
127endif
128LDFLAGS += $(EXTRA_LDFLAGS)
129
130OBJS := rc.o init.o interface.o lan.o wireless.o wan.o pppd.o auth.o services.o #mtd.o
131OBJS += firewall.o ppp.o services.o common.o
132OBJS += watchdog.o ntp.o btnsetup.o qos.o udhcpc.o ate.o #cpu.o
133ifeq ($(RTAC1200G),y)
134OBJS += mtd_sflash.o
135else
136OBJS += mtd.o
137endif
138
139ifeq ($(RTCONFIG_FANCTRL),y)
140OBJS += phy_tempsense.o
141endif
142ifeq ($(RTCONFIG_BCMARM),y)
143OBJS += bcmutils.o
144endif
145
146ifeq ($(RTCONFIG_RALINK),y)
147OBJS += init-ralink.o wps-ralink.o ralink.o ate-ralink.o
148ifeq ($(RTCONFIG_DSL),y)
149OBJS += init-ralink-dsl.o 
150endif
151else ifeq ($(RTCONFIG_QCA),y)
152OBJS += init-qca.o wps-qca.o qca.o ate-qca.o $(if $(wildcard sysdeps/qca/ctl.c),ctl.o,prebuild/ctl.o)
153else
154OBJS += init-broadcom.o wps-broadcom.o broadcom.o ate-broadcom.o
155ifeq ($(BUILD_NAME), RT-AC68U)
156OBJS += cfe.o
157endif
158ifeq ($(RTCONFIG_DSL),y)
159OBJS += init-broadcom-dsl.o
160endif
161endif
162
163# TODO, speedtest
164ifeq ($(RTCONFIG_SPEEDTEST),y)
165OBJS += speedtest.o
166endif
167
168OBJS += wanduck.o
169OBJS += tcpcheck.o
170
171ifeq ($(BUILD_READMEM),y)
172CFLAGS += -DBUILD_READMEM
173OBJS += readmem.o
174endif
175
176ifeq ($(RTCONFIG_USB),y)
177OBJS += usb.o
178OBJS += usbled.o
179OBJS += usb_devices.o
180endif
181
182ifeq ($(RTCONFIG_JFFS2),y)
183OBJS += jffs2.o
184endif
185
186ifeq ($(RTCONFIG_BRCM_NAND_JFFS2),y)
187OBJS += jffs2.o
188endif
189
190ifeq ($(RTCONFIG_UBIFS),y)
191OBJS += ubifs.o
192endif
193
194ifeq ($(RTCONFIG_CIFS),y)
195OBJS += cifs.o
196endif
197
198ifeq ($(RTCONFIG_SSH),y)
199OBJS += ssh.o
200endif
201
202ifeq ($(RTCONFIG_WTFAST),y)
203OBJS += wtfast.o
204endif
205
206ifeq ($(RTCONFIG_PPTPD),y)
207OBJS += vpn.o
208endif
209
210ifeq ($(RTCONFIG_ACCEL_PPTPD),y)
211OBJS += vpn.o
212endif
213
214ifeq ($(RTCONFIG_SNMPD),y)
215OBJS += snmpd.o
216endif
217ifeq ($(RTCONFIG_OPENVPN),y)
218CFLAGS += -DRTCONFIG_CROND
219OBJS += openvpn.o
220endif
221
222ifeq ($(RTCONFIG_PARENTALCTRL),y)
223OBJS += pc.o
224OBJS += pc_block.o
225endif
226
227ifeq ($(RTCONFIG_PUSH_EMAIL),y)
228OBJS += dsl_fb.o
229endif
230
231ifeq ($(RTCONFIG_DSL),y)
232OBJS += dsl.o
233ifeq ($(RTCONFIG_RALINK),y)
234OBJS += dsl-upg.o
235endif
236ifeq ($(RTCONFIG_DSL_TCLINUX),y)
237OBJS += dsl_diag.o
238endif
239endif
240
241ifeq ($(RTCONFIG_BCMWL6),y)
242ifeq ($(RTCONFIG_PROXYSTA),y)
243OBJS += psta_monitor.o
244endif
245endif
246
247ifeq ($(RTCONFIG_WPS),y)
248OBJS += wpsaide.o
249endif
250
251ifeq ($(RTN65U),y)
252OBJS += asm1042.o
253endif
254
255ifeq ($(RTCONFIG_VPNC),y)
256OBJS += vpnc.o
257endif
258
259ifeq ($(RTCONFIG_SHP),y)
260CFLAGS += -DSHP
261endif
262
263ifeq ($(RTCONFIG_USB),y)
264ifneq ($(RTCONFIG_BLINK_LED),y)
265SW_USBLED=y
266endif
267endif
268
269ifeq ($(RTCONFIG_DSL),y)
270ifneq ($(RTCONFIG_DUALWAN),y)
271SW_DSLWANLED=y
272endif
273endif
274
275ifneq (,$(filter y,$(RTCONFIG_WLAN_LED) $(RTN18U) $(RTCONFIG_FAKE_ETLAN_LED) $(SW_USBLED) $(RTCONFIG_MMC_LED) $(RTCONFIG_BRCM_USBAP) $(RTAC66U) $(BCM4352) $(SW_DSLWANLED)))
276CFLAGS += -DSW_DEVLED
277endif
278
279ifeq ($(RTCONFIG_TIMEMACHINE),y)
280OBJS += timemachine.o
281endif
282
283CFLAGS += $(if $(RTCONFIG_BLINK_LED),-I$(TOP)/bled)
284
285export CFLAGS
286
287ifeq ($(RTCONFIG_QTN),y)
288OBJS += icmp.o
289OBJS += qtn.o
290OBJS += find_host_addr.o
291OBJS += qtn_monitor.o
292endif
293
294ifeq ($(RTCONFIG_BWDPI),y)
295OBJS += bwdpi.o
296OBJS += bwdpi_check.o
297OBJS += bwdpi_wred_alive.o
298OBJS += bwdpi_db_10.o
299endif
300
301OBJS += hour_monitor.o
302
303ifeq ($(RTCONFIG_TRAFFIC_LIMITER),y)
304OBJS += traffic_limiter.o
305endif
306
307ifeq ($(RTCONFIG_PUSH_EMAIL),y)
308OBJS += alert_mail.o
309endif
310
311ifeq ($(RTCONFIG_IPERF),y)
312OBJS += monitor.o
313endif
314
315
316ifeq ($(RTCONFIG_HTTPS),y)
317ifeq ($(RTCONFIG_PUSH_EMAIL),y)
318OBJS += pwdec.o
319endif
320endif
321
322ifeq ($(RTCONFIG_INTERNAL_GOBI),y)
323OBJS += lteled.o
324endif
325
326ifeq ($(RTCONFIG_TR069),y)
327OBJS += tr069.o
328endif
329
330ifeq ($(or $(and $(RTCONFIG_USER_LOW_RSSI),$(RTCONFIG_BCMARM)),$(RTCONFIG_NEW_USER_LOW_RSSI)),y)
331OBJS += roamast.o
332endif
333
334ifeq ($(RTCONFIG_TCODE),y)
335OBJS += tcode_rc.o
336ifeq ($(CONFIG_BCMWL5),y)
337OBJS += tcode_brcm.o
338endif
339endif
340
341ifeq ($(RTCONFIG_LACP),y)
342OBJS += agg_brcm.o
343endif
344
345ifeq ($(and $(CONFIG_BCMWL5),$(RTCONFIG_DUALWAN)),y)
346OBJS += dualwan.o
347endif
348
349ifeq ($(RTCONFIG_DHCP_OVERRIDE),y)
350OBJS += detectWAN_arp.o
351endif
352
353ifeq ($(RTCONFIG_KEY_GUARD),y)
354OBJS += keyguard.o
355endif
356
357ifeq ($(RTCONFIG_PORT_BASED_VLAN),y)
358OBJS += vlan.o
359endif
360
361ifeq ($(RTCONFIG_BCMARM),y)
362ifeq ($(RTCONFIG_QTN),y)
363vpath %.c sysdeps sysdeps/broadcom sysdeps/qtn $(TOP)/libqcsapi_client/qcsapi_rpc_common/client $(TOP)/sysdeps/qtn $(SRCBASE)/shared
364else
365vpath %.c sysdeps sysdeps/broadcom $(SRCBASE)/shared
366endif
367else ifeq ($(RTCONFIG_RALINK),y)
368vpath %.c sysdeps sysdeps/ralink
369else ifeq ($(RTCONFIG_QCA),y)
370vpath %.c sysdeps sysdeps/qca
371else
372vpath %.c sysdeps sysdeps/broadcom
373endif
374
375ifeq ($(RTCONFIG_TUNNEL),y)
376OBJS += natnl_api.o
377endif
378
379all: rc
380
381rc: $(OBJS)
382	@echo " [rc] CC $@"
383	@$(CC) -o $@ $^ $(LDFLAGS) $(CFLAGS)
384
385	$(SIZECHECK)
386	$(CPTMP)
387
388install: all
389	@echo "[rc] Installing..."
390	@install -D rc $(INSTALLDIR)/sbin/rc
391	@$(STRIP) $(INSTALLDIR)/sbin/rc
392	@chmod 0500 $(INSTALLDIR)/sbin/rc
393
394ifeq ($(RTCONFIG_BCMARM),y)
395	@cd $(INSTALLDIR)/sbin && ln -sf rc preinit
396else
397	@cd $(INSTALLDIR)/sbin && ln -sf rc init
398endif
399	@cd $(INSTALLDIR)/sbin && ln -sf rc console
400	@cd $(INSTALLDIR)/sbin && ln -sf rc hotplug
401	@cd $(INSTALLDIR)/sbin && ln -sf rc service
402	@cd $(INSTALLDIR)/sbin && ln -sf rc rcheck
403	@cd $(INSTALLDIR)/sbin && ln -sf rc radio
404	@cd $(INSTALLDIR)/sbin && ln -sf rc led_ctrl
405	@cd $(INSTALLDIR)/sbin && ln -sf rc reboot
406	@cd $(INSTALLDIR)/sbin && ln -sf rc halt
407ifeq ($(RTCONFIG_BCMARM),y)
408	@cd $(INSTALLDIR)/sbin && ln -sf rc gpio
409	@cd $(INSTALLDIR)/sbin && ln -sf rc mtd-write2
410	@cd $(INSTALLDIR)/sbin && ln -sf rc mtd-erase2
411else
412	@cd $(INSTALLDIR)/sbin && ln -sf rc mtd-write
413	@cd $(INSTALLDIR)/sbin && ln -sf rc mtd-erase
414endif
415	@cd $(INSTALLDIR)/sbin && ln -sf rc mtd-unlock
416	@cd $(INSTALLDIR)/sbin && ln -sf rc ots
417	@cd $(INSTALLDIR)/sbin && ln -sf rc watchdog
418ifneq ($(RTCONFIG_QCA)$(RTCONFIG_RALINK),y)
419	@cd $(INSTALLDIR)/sbin && ln -sf rc watchdog02
420endif
421	@cd $(INSTALLDIR)/sbin && ln -sf rc sw_devled
422ifeq ($(RTCONFIG_FANCTRL),y)
423	@cd $(INSTALLDIR)/sbin && ln -sf rc phy_tempsense
424endif
425ifeq ($(RTCONFIG_BCMWL6),y)
426ifeq ($(RTCONFIG_PROXYSTA),y)
427	@cd $(INSTALLDIR)/sbin && ln -sf rc psta_monitor
428endif
429endif
430ifeq ($(RTCONFIG_QTN),y)
431	@cd $(INSTALLDIR)/sbin && ln -sf rc qtn_monitor
432	@cd $(INSTALLDIR)/sbin && ln -sf rc start_psta_qtn
433	@cd $(INSTALLDIR)/sbin && ln -sf rc start_ap_qtn
434	@cd $(INSTALLDIR)/sbin && ln -sf rc start_nodfs_scan_qtn
435	@cd $(INSTALLDIR)/sbin && ln -sf rc start_qtn_stateless
436	@cd $(INSTALLDIR)/sbin && ln -sf rc restart_qtn
437endif
438	@cd $(INSTALLDIR)/sbin && ln -sf rc ntp
439	@cd $(INSTALLDIR)/sbin && ln -sf rc autodet
440	@cd $(INSTALLDIR)/sbin && ln -sf rc ddns_updated
441
442#	@cd $(INSTALLDIR)/sbin && ln -sf rc wldist
443
444ifeq ($(RTCONFIG_WPS),y)
445	@cd $(INSTALLDIR)/sbin && ln -sf rc wpsaide
446ifeq ($(RTCONFIG_QCA),y)
447	@cd $(INSTALLDIR)/sbin && ln -sf rc get_wps_er
448endif
449endif
450ifeq ($(RTCONFIG_QCA_PLC_UTILS),y)
451	@cd $(INSTALLDIR)/sbin && ln -sf rc autodet_plc
452endif
453
454#	ifeq ($(RTCONFIG_HEARTBEAT),y)
455#		@cd $(INSTALLDIR)/sbin && ln -sf rc hb_connect
456#		@cd $(INSTALLDIR)/sbin && ln -sf rc hb_disconnect
457#		@cd $(INSTALLDIR)/sbin && ln -sf rc hb_idle
458#	endif
459
460ifeq ($(RTCONFIG_CIFS),y)
461	@cd $(INSTALLDIR)/sbin && ln -sf rc mount-cifs
462endif
463
464ifeq ($(RTCONFIG_RALINK),y)
465ifeq ($(RTCONFIG_DSL),y)
466	@cd $(INSTALLDIR)/sbin && ln -sf rc convert_dsl_wan_settings
467endif
468	@cd $(INSTALLDIR)/sbin && ln -sf rc rtkswitch
469endif
470
471ifeq ($(RTCONFIG_EXT_RTL8365MB),y)
472	@cd $(INSTALLDIR)/sbin && ln -sf rc rtkswitch
473endif
474ifeq ($(RTCONFIG_EXT_RTL8370MB),y)
475	@cd $(INSTALLDIR)/sbin && ln -sf rc rtkswitch
476endif
477
478ifeq ($(RTCONFIG_QCA),y)
479	@cd $(INSTALLDIR)/sbin && ln -sf rc rtkswitch
480endif	
481	@cd $(INSTALLDIR)/sbin && ln -sf rc delay_exec
482
483	@cd $(INSTALLDIR)/sbin && ln -sf rc wanduck
484ifeq ($(and $(CONFIG_BCMWL5),$(RTCONFIG_DUALWAN)),y)
485	@cd $(INSTALLDIR)/sbin && ln -sf rc dualwan
486endif
487	@cd $(INSTALLDIR)/sbin && ln -sf rc tcpcheck
488	@cd $(INSTALLDIR)/sbin && ln -sf rc auto_macclone
489ifeq ($(RTCONFIG_USB),y)
490	@cd $(INSTALLDIR)/sbin && ln -sf rc usbled
491	@cd $(INSTALLDIR)/sbin && ln -sf rc get_apps_name
492ifeq ($(BCM_MMC),y)
493	@cd $(INSTALLDIR)/sbin && ln -sf rc asus_mmc
494endif
495	@cd $(INSTALLDIR)/sbin && ln -sf rc asus_sd
496	@cd $(INSTALLDIR)/sbin && ln -sf rc asus_lp
497	@cd $(INSTALLDIR)/sbin && ln -sf rc asus_sg
498	@cd $(INSTALLDIR)/sbin && ln -sf rc asus_sr
499	@cd $(INSTALLDIR)/sbin && ln -sf rc asus_tty
500	@cd $(INSTALLDIR)/sbin && ln -sf rc asus_usbbcm
501	@cd $(INSTALLDIR)/sbin && ln -sf rc asus_usb_interface
502	@cd $(INSTALLDIR)/sbin && ln -sf rc usb_notify
503	@cd $(INSTALLDIR)/sbin && ln -sf rc ejusb
504ifeq ($(RTCONFIG_DISK_MONITOR),y)
505	@cd $(INSTALLDIR)/sbin && ln -sf rc disk_monitor
506endif
507	@cd $(INSTALLDIR)/sbin && ln -sf rc disk_remove
508ifeq ($(RTCONFIG_APP_PREINSTALLED)$(RTCONFIG_APP_NETINSTALLED),y)
509	@cd $(INSTALLDIR)/sbin && ln -sf rc run_app_script
510	@cd $(INSTALLDIR)/sbin && ln -sf rc chk_app_state
511endif
512endif
513	@cd $(INSTALLDIR)/sbin && ln -sf rc restart_wireless
514ifeq ($(RTCONFIG_BCM_7114),y)
515	@cd $(INSTALLDIR)/sbin && ln -sf rc stop_wl
516endif
517	@cd $(INSTALLDIR)/sbin && ln -sf rc restart_usb
518ifeq ($(RTCONFIG_BCMARM),y)
519	@cd $(INSTALLDIR)/sbin && ln -sf rc nvram_erase
520endif
521	@cd $(INSTALLDIR)/sbin && ln -sf rc ATE
522ifeq ($(or $(RTCONFIG_RALINK),$(RTCONFIG_QCA)),y)
523	@cd $(INSTALLDIR)/sbin && ln -sf rc FWRITE
524	@cd $(INSTALLDIR)/sbin && ln -sf rc FREAD
525endif
526ifeq ($(RTCONFIG_RALINK),y)
527	@cd $(INSTALLDIR)/sbin && ln -sf rc asuscfe_2g
528	@cd $(INSTALLDIR)/sbin && ln -sf rc asuscfe_5g
529	@cd $(INSTALLDIR)/sbin && ln -sf rc stainfo_2g
530	@cd $(INSTALLDIR)/sbin && ln -sf rc stainfo_5g
531ifeq ($(RTCONFIG_DSL),y)
532	@cd $(INSTALLDIR)/sbin && ln -sf rc gen_ralink_config
533endif
534endif
535
536ifeq ($(or $(CONFIG_BCMWL5),$(RTCONFIG_RALINK),$(RTCONFIG_QCA)),y)
537	@cd $(INSTALLDIR)/sbin && ln -sf rc set_factory_mode
538endif
539	@cd $(INSTALLDIR)/sbin && ln -sf rc run_telnetd 
540ifeq ($(RTCONFIG_SSH),y)
541	@cd $(INSTALLDIR)/sbin && ln -sf rc run_sshd
542endif
543ifeq ($(RTCONFIG_WTFAST),y)
544	@cd $(INSTALLDIR)/sbin && ln -sf rc run_wtfast
545endif
546	@cd $(INSTALLDIR)/sbin && ln -sf rc run_pptpd
547ifeq ($(RTCONFIG_PARENTALCTRL),y)
548	@cd $(INSTALLDIR)/sbin && ln -sf rc pc
549	@cd $(INSTALLDIR)/sbin && ln -sf rc pc_block
550endif
551	@cd $(INSTALLDIR)/sbin && ln -sf rc wlcscan
552ifeq ($(RTCONFIG_WIRELESSREPEATER),y)
553	@cd $(INSTALLDIR)/sbin && ln -sf rc wlcconnect
554endif
555ifeq ($(CONFIG_BCMWL5),y)
556	@cd $(INSTALLDIR)/sbin && ln -sf rc setup_dnsmq
557endif
558	@cd $(INSTALLDIR)/sbin && ln -sf rc add_multi_routes
559
560	@cd $(INSTALLDIR)/sbin && ln -sf rc free_caches
561	@cd $(INSTALLDIR)/sbin && ln -sf rc get_phy_status
562	@cd $(INSTALLDIR)/sbin && ln -sf rc get_phy_speed
563	@cd $(INSTALLDIR)/sbin && ln -sf rc firmware_check
564ifeq ($(BUILD_READMEM),y)
565	@cd $(INSTALLDIR)/sbin && ln -sf rc readmem
566endif
567ifeq ($(RTCONFIG_HTTPS),y)
568	@cd $(INSTALLDIR)/sbin && ln -sf rc rsasign_check
569endif
570	@cd $(INSTALLDIR)/sbin && ln -sf rc test_endian
571ifeq ($(RTCONFIG_BWDPI),y)
572	@cd $(INSTALLDIR)/sbin && ln -sf rc rsasign_sig_check
573	@cd $(INSTALLDIR)/sbin && ln -sf rc bwdpi
574	@cd $(INSTALLDIR)/sbin && ln -sf rc bwdpi_check
575	@cd $(INSTALLDIR)/sbin && ln -sf rc bwdpi_wred_alive
576	@cd $(INSTALLDIR)/sbin && ln -sf rc bwdpi_db_10
577endif
578	@cd $(INSTALLDIR)/sbin && ln -sf rc hour_monitor
579ifeq ($(RTCONFIG_SPEEDTEST),y)
580	@cd $(INSTALLDIR)/sbin && ln -sf rc speedtest
581endif
582ifeq ($(RTCONFIG_USB_MODEM),y)
583	@cd $(INSTALLDIR)/sbin && ln -sf rc write_3g_ppp_conf
584ifeq ($(or $(RTCONFIG_JFFS2),$(RTCONFIG_BRCM_NAND_JFFS2),$(RTCONFIG_UBIFS)),y)
585	@cd $(INSTALLDIR)/sbin && ln -sf rc lplus
586	@cd $(INSTALLDIR)/sbin && ln -sf rc lminus
587endif
588endif
589ifeq ($(RTCONFIG_IPERF),y)
590	@cd $(INSTALLDIR)/sbin && ln -sf rc monitor
591endif
592ifeq ($(RTCONFIG_INTERNAL_GOBI),y)
593	@cd $(INSTALLDIR)/sbin && ln -sf rc lteled
594endif
595ifeq ($(RTCONFIG_TR069),y)
596	@cd $(INSTALLDIR)/sbin && ln -sf rc dhcpc_lease
597endif
598
599ifeq ($(or $(and $(RTCONFIG_USER_LOW_RSSI),$(RTCONFIG_BCMARM)),$(RTCONFIG_NEW_USER_LOW_RSSI)),y)
600	@cd $(INSTALLDIR)/sbin && ln -sf rc roamast
601endif
602ifeq ($(RTCONFIG_DHCP_OVERRIDE),y)
603	@cd $(INSTALLDIR)/sbin && ln -sf rc detectWAN_arp
604endif
605ifeq ($(RTCONFIG_KEY_GUARD),y)
606	@cd $(INSTALLDIR)/sbin && ln -sf rc keyguard
607endif
608clean:
609	rm -f rc *.o .*.depend
610
611size: rc
612	mipsel-uclibc-nm --print-size --size-sort rc
613
614# handle prebuilt object here
615ifneq ($(wildcard ./prebuild/dsl_fb.o),)
616ifeq ($(RTCONFIG_PUSH_EMAIL),y)
617dsl_fb.o:
618	@-cp -f ./prebuild/dsl_fb.o .
619endif
620ifeq ($(RTCONFIG_DSL),y)
621ifeq ($(RTCONFIG_DSL_TCLINUX),y)
622dsl_diag.o:
623	@-cp -f ./prebuild/dsl_diag.o .
624endif
625endif
626else
627ifeq ($(RTCONFIG_HTTPS),y)
628ifeq ($(RTCONFIG_PUSH_EMAIL),y)
629dsl_fb.o:dsl_fb.c
630	@echo "encrypt dsl password"
631	./dsl_fb_enc.sh
632	$(CC) $(CFLAGS) -c dsl_fb.c
633	@echo "decrypt dsl password"
634	./dsl_fb_dec.sh
635endif
636endif
637endif
638
639ifeq ($(RTCONFIG_HTTPS),y)
640ifeq ($(RTCONFIG_PUSH_EMAIL),y)
641ifneq ($(wildcard ./prebuild/pwdec.o),)
642pwdec.o:
643	@-cp -f ./prebuild/pwdec.o .
644endif
645endif
646endif
647
648ifeq ($(CONFIG_BCMWL5),y)
649ifneq ($(wildcard ./prebuild/ate-broadcom.o),)
650ate-broadcom.o:
651	@-cp -f ./prebuild/ate-broadcom.o .
652endif
653ifneq ($(wildcard ./prebuild/ate.o),)
654ate.o:
655	@-cp -f ./prebuild/ate.o .
656endif
657ifeq ($(BUILD_NAME), RT-AC68U)
658ifneq ($(wildcard ./prebuild/cfe.o),)
659cfe.o:
660	@-cp -f ./prebuild/cfe.o .
661endif
662endif
663endif
664
665
666ifeq ($(RTCONFIG_RALINK),y)
667ifneq ($(wildcard ./prebuild/ate-ralink.o),)
668ate-ralink.o:
669	@-cp -f ./prebuild/ate-ralink.o .
670endif
671endif
672
673ifeq ($(RTCONFIG_QCA),y)
674ifneq ($(wildcard ./prebuild/ate-qca.o),)
675ate-qca.o:
676	@-cp -f ./prebuild/ate-qca.o .
677endif
678endif
679
680ifeq ($(RTCONFIG_TCODE),y)
681ifneq ($(wildcard ./prebuild/tcode_rc.o),)
682tcode_rc.o:
683	@-cp -f ./prebuild/tcode_rc.o .
684endif
685ifeq ($(CONFIG_BCMWL5),y)
686ifneq ($(wildcard ./prebuild/tcode_brcm.o),)
687tcode_brcm.o:
688	@-cp -f ./prebuild/tcode_brcm.o .
689endif
690endif
691endif
692
693ifeq ($(RTCONFIG_LACP),y)
694ifneq ($(wildcard ./prebuild/agg_brcm.o),)
695agg_brcm.o:
696	@-cp -f ./prebuild/agg_brcm.o .
697endif
698endif
699
700ifeq ($(and $(CONFIG_BCMWL5),$(RTCONFIG_DUALWAN)),y)
701ifneq ($(wildcard ./prebuild/dualwan.o),)
702dualwan.o:
703	@-cp -f ./prebuild/dualwan.o .
704endif
705endif
706
707%.o: %.c
708	@echo " [rc] CC $@"
709	@$(CC) $(CFLAGS) -c $<
710
711.%.depend: %.c
712	@$(CC) $(CFLAGS) -M $< > $@
713
714
715
716pswatch: pswatch.c
717	$(CC) -o $@ $^
718	$(STRIP) $@
719	$(CPTMP)
720