standardize Makefile, only use includes and optimizations on 2.4
[openwrt.git] / package / alsa / Makefile
1
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=alsa-driver
13 PKG_VERSION:=1.0.11
14 PKG_RELEASE:=1
15
16 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
18 PKG_SOURCE_URL:=ftp://ftp.alsa-project.org/pub/driver/
19 PKG_MD5SUM:=57534e4297cd683371402220e3753885
20 PKG_CAT:=bzcat
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/kmod-alsa
25   SECTION:=kernel
26   CATEGORY:=Kernel drivers
27   DEPENDS:=@USB_SUPPORT
28   TITLE:=Advanced Linux Sound Architecture
29   URL:=http://alsa-project.org/
30   VERSION:=$(LINUX_VERSION)+$(PKG_VERSION)-$(BOARD)-$(PKG_RELEASE)
31 endef
32
33 ifeq ($(KERNEL),2.4)
34   ifeq ($(LINUX_KARCH),i386)
35     KERNEL_C_INCS:= -I$(LINUX_DIR)/include/asm-i386/mach-generic -I$(LINUX_DIR)/include/asm-i386/mach-default
36     KERNEL_C_OPTS:= -Os -mpreferred-stack-boundary=2 -march=i486 -fno-unit-at-a-time
37   endif
38   ifeq ($(LINUX_KARCH),mips)
39     KERNEL_C_INCS:= -I$(LINUX_DIR)/include/asm-mips/mach-generic
40     KERNEL_C_OPTS:= -Os -G 0 -mno-abicalls -fno-pic -finline-limit=100000 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
41   endif
42 endif
43
44 define Build/Configure
45         (cd $(PKG_BUILD_DIR); \
46                 CFLAGS="$(KERNEL_C_INCS)" \
47                 ./configure \
48                         --with-build="$(LINUX_DIR)" \
49                         --with-kernel="$(LINUX_DIR)" \
50                         --with-cross="$(KERNEL_CROSS)" \
51                         --with-redhat=no \
52                         --with-suse=no \
53                         --with-oss=yes \
54                         --with-isapnp=no \
55                         --with-sequencer=no \
56                         --with-cards=usb-audio \
57         );
58 endef
59
60 define Build/Compile
61         $(MAKE) -C $(PKG_BUILD_DIR) \
62                 ARCH="$(LINUX_KARCH)" \
63                 CROSS_COMPILE="$(TARGET_CROSS)" \
64                 c_opts="$(KERNEL_C_OPTS)" \
65                 all
66 endef
67
68 define Package/kmod-alsa/install
69         install -d -m0755 $(1)/lib/modules/$(LINUX_VERSION)
70         install -m0644 $(PKG_BUILD_DIR)/modules/*.$(LINUX_KMOD_SUFFIX) \
71                 $(1)/lib/modules/$(LINUX_VERSION)/
72         install -d -m0755 $(1)/etc/modules.d
73         install -m0644 ./files/alsa.modules $(1)/etc/modules.d/70-alsa
74 endef
75
76 $(eval $(call BuildPackage,kmod-alsa))