1#
2# Copyright (C) 2017 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16#
17# This lets us build simple apps that talk to a Citadel dev board.
18#
19
20PROGS = test_citadel
21
22# Assumes a full Nugget OS source tree
23NOS_ROOT = $(realpath ../../..)
24HOST_GENERIC = $(NOS_ROOT)/host/generic
25HOST_LINUX = $(NOS_ROOT)/host/linux
26MPSSE = $(NOS_ROOT)/core/nugget/util/libmpsse/src
27
28INCDIRS = . \
29	$(HOST_GENERIC)/nugget/include \
30	$(HOST_GENERIC)/libnos_datagram/include \
31	$(HOST_GENERIC)/libnos_transport/include \
32	$(MPSSE)
33
34EXT_SRCS = \
35	$(HOST_LINUX)/citadel/libnos_datagram/citadel.c \
36	$(HOST_GENERIC)/libnos_transport/transport.c \
37	$(MPSSE)/mpsse.c \
38	$(MPSSE)/support.c
39
40ifneq ($(DEBUG),)
41CFLAGS += -DDEBUG=$(DEBUG)
42endif
43CFLAGS += -Wall -Werror
44CFLAGS += $(foreach I,$(INCDIRS),-I$(I))
45
46CFLAGS += $(shell pkg-config --cflags libftdi libcrypto)
47LDFLAGS += $(shell pkg-config --libs libftdi libcrypto)
48
49% : %.c $(EXT_SRCS)
50	$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
51
52.PHONY: all
53all: $(PROGS)
54
55.PHONY: clean
56clean:
57	rm -f $(PROGS)
58