-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
68 lines (60 loc) · 2.9 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# ----------------------------------------------------------------------------
# Company : SLAC National Accelerator Laboratory
# ----------------------------------------------------------------------------
# Description:
# Makefile for building drivers, applications, and RCE modules.
# This Makefile provides targets for compiling applications (app),
# drivers, and RCE modules for specific architectures and kernel versions.
# ----------------------------------------------------------------------------
# This file is part of the aes_stream_drivers package. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the aes_stream_drivers package, including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
# ----------------------------------------------------------------------------
# Set the path to the Makefile's directory
MAKE_HOME := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
# Default architecture
ARCH ?= arm
# Discover the local kernel versions
LOC_VERS := $(wildcard /lib/modules/*/build)
LOC_VERS := $(patsubst %/,%,$(dir $(LOC_VERS)))
LOC_VERS := $(notdir $(LOC_VERS))
# Define RCE module directories
RCE_DIRS := /sdf/group/faders/tools/xilinx/rce_linux_kernel/linux-xlnx-v2016.4
RCE_DIRS += /sdf/group/faders/tools/xilinx/rce_linux_kernel/backup/linux-xlnx-v2016.1.01
# Default target: Display the available build options
all:
@echo "Available targets: app driver rce"
# Build applications
app:
@echo "Building applications..."
@make -C $(MAKE_HOME)/rce_stream/app clean
@make -C $(MAKE_HOME)/rce_stream/app
@make -C $(MAKE_HOME)/data_dev/app clean
@make -C $(MAKE_HOME)/data_dev/app
# Build drivers for each discovered kernel version
driver:
@echo "Building drivers for all kernel versions..."
@mkdir -p $(MAKE_HOME)/install
@$(foreach ver,$(LOC_VERS), \
mkdir -p $(MAKE_HOME)/install/$(ver); \
make -C $(MAKE_HOME)/data_dev/driver KVER=$(ver) clean; \
make -C $(MAKE_HOME)/data_dev/driver KVER=$(ver); \
scp $(MAKE_HOME)/data_dev/driver/*.ko $(MAKE_HOME)/install/$(ver); \
)
# Build RCE modules for specified directories
rce:
@echo "Building RCE modules..."
@mkdir -p $(MAKE_HOME)/install
@$(foreach d,$(RCE_DIRS), \
mkdir -p $(MAKE_HOME)/install/$(shell make -C $(d) -s kernelversion).$(ARCH); \
make -C $(MAKE_HOME)/rce_stream/driver KDIR=$(d) clean; \
make -C $(MAKE_HOME)/rce_stream/driver KDIR=$(d); \
scp $(MAKE_HOME)/rce_stream/driver/*.ko $(MAKE_HOME)/install/$(shell make -C $(d) -s kernelversion).$(ARCH)/; \
make -C $(MAKE_HOME)/rce_memmap/driver KDIR=$(d) clean; \
make -C $(MAKE_HOME)/rce_memmap/driver KDIR=$(d); \
scp $(MAKE_HOME)/rce_memmap/driver/*.ko $(MAKE_HOME)/install/$(shell make -C $(d) -s kernelversion).$(ARCH)/; \
)