Makefile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. # Toolchain commands
  20. CROSS_COMPILE ?=
  21. CC := ccache $(CROSS_COMPLIE)gcc
  22. CXX := ccache $(CROSS_COMPILE)g++
  23. LD := $(CROSS_COMPILE)gcc
  24. AR := $(CROSS_COMPILE)ar
  25. AS := $(CROSS_COMPILE)as
  26. NM := $(CROSS_COMPILE)nm
  27. OBJDUMP := $(CROSS_COMPILE)objdump
  28. OBJCOPY := $(CROSS_COMPILE)objcopy
  29. SIZE := $(CROSS_COMPILE)size
  30. # Configure NimBLE variables
  31. NIMBLE_ROOT := ../../..
  32. NIMBLE_CFG_TINYCRYPT := 1
  33. include $(NIMBLE_ROOT)/porting/nimble/Makefile.defs
  34. # Add dummy NPL, dummy HCI transport and all NimBLE sources to build
  35. SRC = \
  36. $(NIMBLE_ROOT)/porting/npl/dummy/src/npl_os_dummy.c \
  37. $(NIMBLE_ROOT)/porting/npl/dummy/src/hci_dummy.c \
  38. $(NIMBLE_SRC) \
  39. $(TINYCRYPT_SRC) \
  40. main.c \
  41. # Add dummy NPL and all NimBLE directories to include paths
  42. INC = \
  43. $(NIMBLE_ROOT)/porting/npl/dummy/include \
  44. $(NIMBLE_INCLUDE) \
  45. $(TINYCRYPT_INCLUDE) \
  46. $(INCLUDE) \
  47. OBJ := $(SRC:.c=.o)
  48. TINYCRYPT_OBJ := $(TINYCRYPT_SRC:.c=.o)
  49. CFLAGS := $(NIMBLE_CFLAGS)
  50. .PHONY: all clean
  51. .DEFAULT: all
  52. all: dummy
  53. clean:
  54. rm $(OBJ) -f
  55. rm dummy -f
  56. $(TINYCRYPT_OBJ): CFLAGS+=$(TINYCRYPT_CFLAGS)
  57. %.o: %.c
  58. $(CC) -c $(addprefix -I, $(INC)) $(CFLAGS) -o $@ $<
  59. dummy: $(OBJ) $(TINYCRYPT_OBJ)
  60. $(CC) -o $@ $^