Taylor Hutt | 8982204 | 2011-08-23 14:44:34 -0700 | [diff] [blame] | 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. |
Taylor Hutt | 8982204 | 2011-08-23 14:44:34 -0700 | [diff] [blame] | 4 | |
| 5 | export ADHD_DIR = $(shell pwd) |
| 6 | include $(ADHD_DIR)/defs/definitions.mk |
| 7 | |
Taylor Hutt | 8e648ba | 2012-06-22 09:40:58 -0700 | [diff] [blame] | 8 | all: cras |
Taylor Hutt | bbca6ef | 2012-02-23 09:33:34 -0800 | [diff] [blame] | 9 | |
| 10 | cras: |
| 11 | @$(call remake,Building,$@,cras.mk,$@) |
| 12 | |
| 13 | cras_install: |
| 14 | @$(call remake,Building,cras,cras.mk,$@) |
Taylor Hutt | 8982204 | 2011-08-23 14:44:34 -0700 | [diff] [blame] | 15 | |
Owen Lin | 529b851 | 2014-01-06 18:51:19 +0800 | [diff] [blame] | 16 | cras-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 Floares | 94e6f4d | 2016-08-22 17:22:47 +0300 | [diff] [blame] | 22 | cras_init_upstart: $(ADHD_DIR)/init/cras.conf |
| 23 | $(ECHO) "Installing upstart file" |
| 24 | $(INSTALL) --mode 644 -D $< $(DESTDIR)/etc/init/cras.conf |
| 25 | |
| 26 | cras_init_scripts: $(ADHD_DIR)/init/cras.sh |
| 27 | $(INSTALL) --mode 644 -D $< $(DESTDIR)/usr/share/cros/init/cras.sh |
| 28 | |
| 29 | SYSTEMD_UNIT_DIR := /usr/lib/systemd/system/ |
| 30 | SYSTEMD_TMPFILESD_DIR := /usr/lib/tmpfiles.d/ |
| 31 | |
| 32 | cras_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 | |
| 43 | ifeq ($(strip $(SYSTEMD)), yes) |
| 44 | |
| 45 | cras_init: cras_init_systemd cras_init_scripts |
| 46 | |
| 47 | else |
| 48 | |
| 49 | cras_init: cras_init_upstart cras_init_scripts |
| 50 | |
| 51 | endif |
Dylan Reid | b3cea3e | 2012-02-21 23:21:25 -0800 | [diff] [blame] | 52 | |
Dylan Reid | d3474cb | 2012-07-16 17:57:25 -0700 | [diff] [blame] | 53 | $(DESTDIR)/etc/cras/device_blacklist: $(ADHD_DIR)/cras-config/device_blacklist |
| 54 | $(ECHO) "Installing '$<' to '$@'" |
| 55 | $(INSTALL) --mode 644 -D $< $@ |
| 56 | |
Dylan Reid | 3683d5e | 2012-06-06 20:42:05 -0700 | [diff] [blame] | 57 | optional_alsa_conf := $(wildcard $(ADHD_DIR)/alsa-module-config/alsa-$(BOARD).conf) |
| 58 | |
| 59 | ifneq ($(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 | |
| 65 | install: $(DESTDIR)/etc/modprobe.d/alsa-$(BOARD).conf |
| 66 | |
| 67 | endif |
| 68 | |
Dylan Reid | ba647bc | 2013-07-16 18:26:21 -0700 | [diff] [blame] | 69 | optional_alsa_patch := $(wildcard $(ADHD_DIR)/alsa-module-config/$(BOARD)_alsa.fw) |
| 70 | |
| 71 | ifneq ($(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 | |
| 77 | install: $(DESTDIR)/lib/firmware/$(BOARD)_alsa.fw |
| 78 | |
| 79 | endif |
| 80 | |
Sabin Floares | 94e6f4d | 2016-08-22 17:22:47 +0300 | [diff] [blame] | 81 | install: $(DESTDIR)/etc/cras/device_blacklist \ |
Owen Lin | 529b851 | 2014-01-06 18:51:19 +0800 | [diff] [blame] | 82 | cras-scripts \ |
Sabin Floares | 94e6f4d | 2016-08-22 17:22:47 +0300 | [diff] [blame] | 83 | cras_install \ |
| 84 | cras_init |
| 85 | |
Taylor Hutt | 8982204 | 2011-08-23 14:44:34 -0700 | [diff] [blame] | 86 | clean: |
| 87 | @rm -rf $(ADHD_BUILD_DIR) |
| 88 | |
Owen Lin | 529b851 | 2014-01-06 18:51:19 +0800 | [diff] [blame] | 89 | .PHONY: clean cras cras_install cras-script |