blob: 2be9ec9b997af86bd28f9b84e0290428f5767c73 [file] [log] [blame]
Taylor Hutt89822042011-08-23 14:44:34 -07001# 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.
Taylor Hutt89822042011-08-23 14:44:34 -07004
5export ADHD_DIR = $(shell pwd)
6include $(ADHD_DIR)/defs/definitions.mk
7
Taylor Hutt8e648ba2012-06-22 09:40:58 -07008all: cras
Taylor Huttbbca6ef2012-02-23 09:33:34 -08009
10cras:
11 @$(call remake,Building,$@,cras.mk,$@)
12
13cras_install:
14 @$(call remake,Building,cras,cras.mk,$@)
Taylor Hutt89822042011-08-23 14:44:34 -070015
Owen Lin529b8512014-01-06 18:51:19 +080016cras-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
Sabin Floares94e6f4d2016-08-22 17:22:47 +030022cras_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
Dylan Reidb3cea3e2012-02-21 23:21:25 -080052
Dylan Reidd3474cb2012-07-16 17:57:25 -070053$(DESTDIR)/etc/cras/device_blacklist: $(ADHD_DIR)/cras-config/device_blacklist
54 $(ECHO) "Installing '$<' to '$@'"
55 $(INSTALL) --mode 644 -D $< $@
56
Dylan Reid3683d5e2012-06-06 20:42:05 -070057optional_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
Dylan Reidba647bc2013-07-16 18:26:21 -070069optional_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
Sabin Floares94e6f4d2016-08-22 17:22:47 +030081install: $(DESTDIR)/etc/cras/device_blacklist \
Owen Lin529b8512014-01-06 18:51:19 +080082 cras-scripts \
Sabin Floares94e6f4d2016-08-22 17:22:47 +030083 cras_install \
84 cras_init
85
Taylor Hutt89822042011-08-23 14:44:34 -070086clean:
87 @rm -rf $(ADHD_BUILD_DIR)
88
Owen Lin529b8512014-01-06 18:51:19 +080089.PHONY: clean cras cras_install cras-script