improve clean targets
[buildroot.git] / package / pcmcia / pcmcia.mk
blob1e42a27515961864e45825211f7244c80694c2d7
1 #############################################################
3 # pcmcia card services
5 #############################################################
6 # Copyright (C) 2001-2003 by Erik Andersen <andersen@codepoet.org>
7 # Copyright (C) 2002 by Tim Riker <Tim@Rikers.org>
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU Library General Public License as
11 # published by the Free Software Foundation; either version 2 of the
12 # License, or (at your option) any later version.
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Library General Public License for more details.
19 # You should have received a copy of the GNU Library General Public
20 # License along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 # USA
24 PCMCIA_SOURCE:=pcmcia-cs-3.2.7.tar.gz
25 PCMCIA_SITE:=http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/pcmcia-cs
26 PCMCIA_DIR:=$(BUILD_DIR)/pcmcia-cs-3.2.7
27 PCMCIA_CAT:=$(ZCAT)
29 $(DL_DIR)/$(PCMCIA_SOURCE):
30 $(WGET) -P $(DL_DIR) $(PCMCIA_SITE)/$(PCMCIA_SOURCE)
32 pcmcia-source: $(DL_DIR)/$(PCMCIA_SOURCE)
34 $(PCMCIA_DIR)/.unpacked: $(DL_DIR)/$(PCMCIA_SOURCE)
35 $(PCMCIA_CAT) $(DL_DIR)/$(PCMCIA_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
36 touch $(PCMCIA_DIR)/.unpacked
38 $(PCMCIA_DIR)/.patched: $(PCMCIA_DIR)/.unpacked
39 toolchain/patch-kernel.sh $(PCMCIA_DIR) package/pcmcia/ pcmcia\*.patch
40 touch $(PCMCIA_DIR)/.patched
42 $(PCMCIA_DIR)/.configured: $(PCMCIA_DIR)/.patched
43 ( cd $(PCMCIA_DIR); ./Configure --kernel=$(LINUX26_DIR) --noprompt \
44 --rcdir=/etc --arch=$(ARCH) --trust --srctree --nocardbus \
45 --sysv --kcc=$(KERNEL_CROSS)gcc --ucc=$(TARGET_CC) --ld=$(TARGET_CROSS)ld \
46 --target=$(TARGET_DIR))
47 $(SED) "s/pump/udhcpc/" $(PCMCIA_DIR)/etc/network
48 $(SED) "s/ide_cs/ide-cs/" $(PCMCIA_DIR)/etc/config
49 $(SED) "s/bind \"wvlan_cs\"/bind \"orinoco_cs\"/g" $(PCMCIA_DIR)/etc/config
50 touch $(PCMCIA_DIR)/.configured
52 $(PCMCIA_DIR)/cardmgr/cardmgr: $(PCMCIA_DIR)/.configured
53 $(MAKE) -C $(PCMCIA_DIR) -i all
54 -A=`find $(PCMCIA_DIR) -type f -perm +111`; \
55 for fo in $$A; do \
56 file $$fo | grep "ELF" | grep "executable" > /dev/null 2>&1; \
57 if [ $$? = 0 ]; then \
58 $(STRIPCMD) $$fo; \
59 fi; \
60 done
61 touch -c $(PCMCIA_DIR)/cardmgr/cardmgr
63 $(TARGET_DIR)/sbin/cardmgr: $(PCMCIA_DIR)/cardmgr/cardmgr
64 rm -rf $(TARGET_DIR)/etc/pcmcia
65 $(MAKE) -i -C $(PCMCIA_DIR) install
66 rm -rf $(TARGET_DIR)/usr/man
67 rm -rf $(TARGET_DIR)/usr/share/man
68 rm -rf $(TARGET_DIR)/usr/X11R6/man
69 rm -rf $(TARGET_DIR)/etc/rc.d
70 rm -rf $(TARGET_DIR)/etc/rc?.d
71 rm -f $(TARGET_DIR)/etc/init.d/pcmcia*
72 rm -f $(TARGET_DIR)/sbin/dump_cis $(TARGET_DIR)/sbin/pack_cis
73 rm -f $(TARGET_DIR)/usr/share/pnp.ids $(TARGET_DIR)/sbin/lspnp $(TARGET_DIR)/sbin/setpnp
74 rm -f $(TARGET_DIR)/sbin/pcinitrd
75 rm -f $(TARGET_DIR)/sbin/probe
76 rm -f $(TARGET_DIR)/sbin/ide_info
77 rm -f $(TARGET_DIR)/sbin/scsi_info
78 rm -f $(TARGET_DIR)/sbin/ftl_check
79 rm -f $(TARGET_DIR)/sbin/ftl_format
80 rm -f $(TARGET_DIR)/usr/X11R6/bin/xcardinfo
81 rm -rf $(TARGET_DIR)/etc/sysconfig
82 mkdir -p $(TARGET_DIR)/etc/default
83 cp -f $(PCMCIA_DIR)/etc/pcmcia $(TARGET_DIR)/etc/default/
84 cp -f $(PCMCIA_DIR)/etc/rc.pcmcia $(TARGET_DIR)/etc/init.d/S30pcmcia
85 rm -rf $(TARGET_DIR)/etc/pcmcia/cis
86 chmod a+x $(TARGET_DIR)/etc/init.d/S30pcmcia
87 chmod -R u+w $(TARGET_DIR)/etc/pcmcia/*
89 # use busybox depmod.pl so we need the sources unpacked
90 $(PCMCIA_DIR)/.modules.dep: $(BUSYBOX_DIR)/.configured $(TARGET_DIR)/lib/modules
91 [ -d $(TARGET_DIR)/lib/modules/$(LINUX26_VERSION) ] && \
92 $(BUSYBOX_DIR)/examples/depmod.pl \
93 -b $(TARGET_DIR)/lib/modules/$(LINUX26_VERSION)/ \
94 -F $(LINUX26_DIR)/System.map \
95 > $(TARGET_DIR)/lib/modules/$(LINUX26_VERSION)/modules.dep
96 touch $(PCMCIA_DIR)/.modules.dep
98 pcmcia: uclibc linux26 $(TARGET_DIR)/sbin/cardmgr $(PCMCIA_DIR)/.modules.dep
100 pcmcia-clean:
101 rm -f $(TARGET_DIR)/sbin/cardmgr
102 -$(MAKE) -C $(PCMCIA_DIR) clean
103 rm -f $(PCMCIA_DIR)/.configured $(PCMCIA_DIR)/config.out
105 pcmcia-dirclean:
106 rm -rf $(PCMCIA_DIR)
107 #############################################################
109 # Toplevel Makefile options
111 #############################################################
112 ifeq ($(BR2_PACKAGE_PCMCIA),y)
113 TARGETS+=pcmcia
114 endif