fix svn patch breakage in glib
[openwrt/svn-archive/archive.git] / obsolete-buildroot / make / pcmcia.mk
1 #############################################################
2 #
3 # pcmcia card services
4 #
5 #############################################################
6 # Copyright (C) 2001-2003 by Erik Andersen <andersen@codepoet.org>
7 # Copyright (C) 2002 by Tim Riker <Tim@Rikers.org>
8 #
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.
13 #
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.
18 #
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
23
24 PCMCIA_SOURCE:=pcmcia-cs-3.2.7.tar.gz
25 PCMCIA_SITE:=http://aleron.dl.sourceforge.net/sourceforge/pcmcia-cs
26 PCMCIA_DIR:=$(BUILD_DIR)/pcmcia-cs-3.2.7
27 PCMCIA_PATCH:=$(SOURCE_DIR)/pcmcia.patch
28 PCMCIA_CAT:=zcat
29
30 $(DL_DIR)/$(PCMCIA_SOURCE):
31 $(WGET) -P $(DL_DIR) $(PCMCIA_SITE)/$(PCMCIA_SOURCE)
32
33 pcmcia-source: $(DL_DIR)/$(PCMCIA_SOURCE)
34
35 $(PCMCIA_DIR)/.unpacked: $(DL_DIR)/$(PCMCIA_SOURCE)
36 $(PCMCIA_CAT) $(DL_DIR)/$(PCMCIA_SOURCE) | tar -C $(BUILD_DIR) -xvf -
37 touch $(PCMCIA_DIR)/.unpacked
38
39 $(PCMCIA_DIR)/.patched: $(PCMCIA_DIR)/.unpacked
40 cat $(PCMCIA_PATCH) | patch -d $(PCMCIA_DIR) -p1
41 touch $(PCMCIA_DIR)/.patched
42
43 $(PCMCIA_DIR)/.configured: $(PCMCIA_DIR)/.patched
44 ( cd $(PCMCIA_DIR) ; ./Configure --kernel=$(LINUX_SOURCE_DIR) --noprompt \
45 --rcdir=/etc --arch=$(ARCH) --trust --srctree --nocardbus \
46 --sysv --kcc=$(KERNEL_CROSS)gcc --ucc=$(TARGET_CC) --ld=$(TARGET_CROSS)ld \
47 --target=$(TARGET_DIR))
48 $(SED) "s/pump/udhcpc/" $(PCMCIA_DIR)/etc/network
49 $(SED) "s/ide_cs/ide-cs/" $(PCMCIA_DIR)/etc/config
50 $(SED) "s/bind \"wvlan_cs\"/bind \"orinoco_cs\"/g" $(PCMCIA_DIR)/etc/config
51 touch $(PCMCIA_DIR)/.configured
52
53 $(PCMCIA_DIR)/cardmgr/cardmgr: $(PCMCIA_DIR)/.configured
54 $(MAKE) -C $(PCMCIA_DIR) -i all
55 -A=`find $(PCMCIA_DIR) -type f -perm +111` ; \
56 for fo in $$A; do \
57 file $$fo | grep "ELF" | grep "executable" > /dev/null 2>&1; \
58 if [ $$? = 0 ] ; then \
59 $(STRIP) $$fo; \
60 fi; \
61 done
62 touch -c $(PCMCIA_DIR)/cardmgr/cardmgr
63
64 $(TARGET_DIR)/sbin/cardmgr: $(PCMCIA_DIR)/cardmgr/cardmgr
65 rm -rf $(TARGET_DIR)/etc/pcmcia;
66 $(MAKE) -i -C $(PCMCIA_DIR) install
67 rm -rf $(TARGET_DIR)/usr/man;
68 rm -rf $(TARGET_DIR)/usr/share/man;
69 rm -rf $(TARGET_DIR)/usr/X11R6/man;
70 rm -rf $(TARGET_DIR)/etc/rc.d;
71 rm -rf $(TARGET_DIR)/etc/rc?.d;
72 rm -f $(TARGET_DIR)/etc/init.d/pcmcia*;
73 rm -f $(TARGET_DIR)/sbin/dump_cis $(TARGET_DIR)/sbin/pack_cis
74 rm -f $(TARGET_DIR)/usr/share/pnp.ids $(TARGET_DIR)/sbin/lspnp $(TARGET_DIR)/sbin/setpnp;
75 rm -f $(TARGET_DIR)/sbin/pcinitrd
76 rm -f $(TARGET_DIR)/sbin/probe
77 rm -f $(TARGET_DIR)/sbin/ide_info
78 rm -f $(TARGET_DIR)/sbin/scsi_info
79 rm -f $(TARGET_DIR)/sbin/ftl_check
80 rm -f $(TARGET_DIR)/sbin/ftl_format
81 rm -f $(TARGET_DIR)/usr/X11R6/bin/xcardinfo
82 rm -rf $(TARGET_DIR)/etc/sysconfig
83 mkdir -p $(TARGET_DIR)/etc/default
84 cp -f $(PCMCIA_DIR)/etc/pcmcia $(TARGET_DIR)/etc/default/
85 cp -f $(PCMCIA_DIR)/etc/rc.pcmcia $(TARGET_DIR)/etc/init.d/S30pcmcia
86 rm -rf $(TARGET_DIR)/etc/pcmcia/cis
87 chmod a+x $(TARGET_DIR)/etc/init.d/S30pcmcia
88 chmod -R u+w $(TARGET_DIR)/etc/pcmcia/*
89
90 # use busybox depmod.pl so we need the sources unpacked
91 $(PCMCIA_DIR)/.modules.dep: $(BUSYBOX_DIR)/.configured $(TARGET_DIR)/lib/modules
92 [ -d $(TARGET_DIR)/lib/modules/$(LINUX_VERSION) ] && \
93 $(BUSYBOX_DIR)/examples/depmod.pl \
94 -b $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)/ \
95 -k $(LINUX_DIR)/vmlinux \
96 -F $(LINUX_DIR)/System.map \
97 > $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)/modules.dep
98 touch $(PCMCIA_DIR)/.modules.dep
99
100 pcmcia: uclibc $(TARGET_DIR)/sbin/cardmgr $(PCMCIA_DIR)/.modules.dep
101
102 pcmcia-clean:
103 rm -f $(TARGET_DIR)/sbin/cardmgr
104 -$(MAKE) -C $(PCMCIA_DIR) clean
105 rm -f $(PCMCIA_DIR)/.configured $(PCMCIA_DIR)/config.out
106
107 pcmcia-dirclean:
108 rm -rf $(PCMCIA_DIR)