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 $(INSTALL) --mode 755 -D $(ADHD_DIR)/scripts/asoc_dapm_graph \ 22 $(DESTDIR)/usr/bin/ 23 24cras_init_upstart: $(ADHD_DIR)/init/cras.conf 25 $(ECHO) "Installing upstart file" 26 $(INSTALL) --mode 644 -D $< $(DESTDIR)/etc/init/cras.conf 27 28cras_init_scripts: $(ADHD_DIR)/init/cras.sh 29 $(INSTALL) --mode 644 -D $< $(DESTDIR)/usr/share/cros/init/cras.sh 30 31SYSTEMD_UNIT_DIR := /usr/lib/systemd/system/ 32SYSTEMD_TMPFILESD_DIR := /usr/lib/tmpfiles.d/ 33 34cras_init_systemd: $(ADHD_DIR)/init/cras.service \ 35 $(ADHD_DIR)/init/cras-directories.conf 36 $(ECHO) "Installing systemd files" 37 $(INSTALL) --mode 644 -D $(ADHD_DIR)/init/cras.service \ 38 $(DESTDIR)/$(SYSTEMD_UNIT_DIR)/cras.service 39 $(INSTALL) --mode 755 -d $(DESTDIR)/$(SYSTEMD_UNIT_DIR)/system-services.target.wants 40 $(LINK) -s ../cras.service \ 41 $(DESTDIR)/$(SYSTEMD_UNIT_DIR)/system-services.target.wants/cras.service 42 $(INSTALL) --mode 644 -D $(ADHD_DIR)/init/cras-directories.conf \ 43 $(DESTDIR)/$(SYSTEMD_TMPFILESD_DIR)/cras-directories.conf 44 45ifeq ($(strip $(SYSTEMD)), yes) 46 47cras_init: cras_init_systemd cras_init_scripts 48 49else 50 51cras_init: cras_init_upstart cras_init_scripts 52 53endif 54 55$(DESTDIR)/etc/cras/device_blocklist: $(ADHD_DIR)/cras-config/device_blocklist 56 $(ECHO) "Installing '$<' to '$@'" 57 $(INSTALL) --mode 644 -D $< $@ 58 59# Note: $(BOARD) usage is deprecated. Configs should be added in board overlays 60# or via cros_config data for newer unibuild systems. 61 62optional_alsa_conf := $(wildcard $(ADHD_DIR)/alsa-module-config/alsa-$(BOARD).conf) 63 64ifneq ($(strip $(optional_alsa_conf)),) 65 66$(DESTDIR)/etc/modprobe.d/alsa-$(BOARD).conf: $(optional_alsa_conf) 67 $(ECHO) "Installing '$<' to '$@'" 68 $(INSTALL) --mode 644 -D $< $@ 69 70install: $(DESTDIR)/etc/modprobe.d/alsa-$(BOARD).conf 71 72endif 73 74optional_alsa_patch := $(wildcard $(ADHD_DIR)/alsa-module-config/$(BOARD)_alsa.fw) 75 76ifneq ($(strip $(optional_alsa_patch)),) 77 78$(DESTDIR)/lib/firmware/$(BOARD)_alsa.fw: $(optional_alsa_patch) 79 $(ECHO) "Installing '$<' to '$@'" 80 $(INSTALL) --mode 644 -D $< $@ 81 82install: $(DESTDIR)/lib/firmware/$(BOARD)_alsa.fw 83 84endif 85 86install: $(DESTDIR)/etc/cras/device_blocklist \ 87 cras-scripts \ 88 cras_install \ 89 cras_init 90 91clean: 92 @rm -rf $(ADHD_BUILD_DIR) 93 94.PHONY: clean cras cras_install cras-script 95