• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5export ADHD_DIR = $(shell pwd)
6include $(ADHD_DIR)/defs/definitions.mk
7
8all:	cras
9
10cras:
11	@$(call remake,Building,$@,cras.mk,$@)
12
13cras_install:
14	@$(call remake,Building,cras,cras.mk,$@)
15
16cras-scripts:
17	$(ECHO) "Installing cras scripts"
18	$(INSTALL) --mode 755 -d $(DESTDIR)usr/bin/
19	$(INSTALL) --mode 755 -D $(ADHD_DIR)/scripts/audio_diagnostics \
20		$(DESTDIR)usr/bin/
21
22cras_init_upstart:	$(ADHD_DIR)/init/cras.conf
23	$(ECHO) "Installing upstart file"
24	$(INSTALL) --mode 644 -D $< $(DESTDIR)/etc/init/cras.conf
25
26cras_init_scripts:	$(ADHD_DIR)/init/cras.sh
27	$(INSTALL) --mode 644 -D $< $(DESTDIR)/usr/share/cros/init/cras.sh
28
29SYSTEMD_UNIT_DIR := /usr/lib/systemd/system/
30SYSTEMD_TMPFILESD_DIR := /usr/lib/tmpfiles.d/
31
32cras_init_systemd:	$(ADHD_DIR)/init/cras.service \
33	$(ADHD_DIR)/init/cras-directories.conf
34	$(ECHO) "Installing systemd files"
35	$(INSTALL) --mode 644 -D $(ADHD_DIR)/init/cras.service \
36		$(DESTDIR)/$(SYSTEMD_UNIT_DIR)/cras.service
37	$(INSTALL) --mode 755 -d $(DESTDIR)/$(SYSTEMD_UNIT_DIR)/system-services.target.wants
38	$(LINK) -s ../cras.service \
39		$(DESTDIR)/$(SYSTEMD_UNIT_DIR)/system-services.target.wants/cras.service
40	$(INSTALL) --mode 644 -D $(ADHD_DIR)/init/cras-directories.conf \
41		$(DESTDIR)/$(SYSTEMD_TMPFILESD_DIR)/cras-directories.conf
42
43ifeq ($(strip $(SYSTEMD)), yes)
44
45cras_init: cras_init_systemd cras_init_scripts
46
47else
48
49cras_init: cras_init_upstart cras_init_scripts
50
51endif
52
53$(DESTDIR)/etc/cras/device_blacklist:	$(ADHD_DIR)/cras-config/device_blacklist
54	$(ECHO) "Installing '$<' to '$@'"
55	$(INSTALL) --mode 644 -D $< $@
56
57optional_alsa_conf := $(wildcard $(ADHD_DIR)/alsa-module-config/alsa-$(BOARD).conf)
58
59ifneq ($(strip $(optional_alsa_conf)),)
60
61$(DESTDIR)/etc/modprobe.d/alsa-$(BOARD).conf:	$(optional_alsa_conf)
62	$(ECHO) "Installing '$<' to '$@'"
63	$(INSTALL) --mode 644 -D $< $@
64
65install:	$(DESTDIR)/etc/modprobe.d/alsa-$(BOARD).conf
66
67endif
68
69optional_alsa_patch := $(wildcard $(ADHD_DIR)/alsa-module-config/$(BOARD)_alsa.fw)
70
71ifneq ($(strip $(optional_alsa_patch)),)
72
73$(DESTDIR)/lib/firmware/$(BOARD)_alsa.fw:	$(optional_alsa_patch)
74	$(ECHO) "Installing '$<' to '$@'"
75	$(INSTALL) --mode 644 -D $< $@
76
77install:	$(DESTDIR)/lib/firmware/$(BOARD)_alsa.fw
78
79endif
80
81install:	$(DESTDIR)/etc/cras/device_blacklist \
82		cras-scripts \
83		cras_install \
84		cras_init
85
86clean:
87	@rm -rf $(ADHD_BUILD_DIR)
88
89.PHONY:	clean cras cras_install cras-script
90