xref: /nrf52832-nimble/packages/NimBLE-latest/porting/examples/dummy/Makefile (revision 042d53a763ad75cb1465103098bb88c245d95138)
1#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements.  See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership.  The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License.  You may obtain a copy of the License at
9#
10#  http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied.  See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
20# Toolchain commands
21CROSS_COMPILE ?=
22CC      := ccache $(CROSS_COMPLIE)gcc
23CXX     := ccache $(CROSS_COMPILE)g++
24LD      := $(CROSS_COMPILE)gcc
25AR      := $(CROSS_COMPILE)ar
26AS      := $(CROSS_COMPILE)as
27NM      := $(CROSS_COMPILE)nm
28OBJDUMP := $(CROSS_COMPILE)objdump
29OBJCOPY := $(CROSS_COMPILE)objcopy
30SIZE    := $(CROSS_COMPILE)size
31
32# Configure NimBLE variables
33NIMBLE_ROOT := ../../..
34NIMBLE_CFG_TINYCRYPT := 1
35include $(NIMBLE_ROOT)/porting/nimble/Makefile.defs
36
37# Add dummy NPL, dummy HCI transport and all NimBLE sources to build
38SRC = \
39	$(NIMBLE_ROOT)/porting/npl/dummy/src/npl_os_dummy.c \
40	$(NIMBLE_ROOT)/porting/npl/dummy/src/hci_dummy.c \
41	$(NIMBLE_SRC) \
42	$(TINYCRYPT_SRC) \
43	main.c \
44
45# Add dummy NPL and all NimBLE directories to include paths
46INC = \
47	$(NIMBLE_ROOT)/porting/npl/dummy/include \
48	$(NIMBLE_INCLUDE) \
49	$(TINYCRYPT_INCLUDE) \
50	$(INCLUDE) \
51
52OBJ := $(SRC:.c=.o)
53TINYCRYPT_OBJ := $(TINYCRYPT_SRC:.c=.o)
54
55CFLAGS := $(NIMBLE_CFLAGS)
56
57.PHONY: all clean
58.DEFAULT: all
59
60all: dummy
61
62clean:
63	rm $(OBJ) -f
64	rm dummy -f
65
66$(TINYCRYPT_OBJ): CFLAGS+=$(TINYCRYPT_CFLAGS)
67
68%.o: %.c
69	$(CC) -c $(addprefix -I, $(INC)) $(CFLAGS) -o $@ $<
70
71dummy: $(OBJ) $(TINYCRYPT_OBJ)
72	$(CC) -o $@ $^
73