Makefile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_COMPILE)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. # Skip files that don't build for this port
  34. NIMBLE_IGNORE := $(NIMBLE_ROOT)/nimble/host/src/ble_gatts_lcl.c \
  35. $(NIMBLE_ROOT)/porting/nimble/src/hal_timer.c \
  36. $(NIMBLE_ROOT)/porting/nimble/src/os_cputime.c \
  37. $(NIMBLE_ROOT)/porting/nimble/src/os_cputime_pwr2.c \
  38. $(NULL)
  39. include $(NIMBLE_ROOT)/porting/nimble/Makefile.defs
  40. # Add dummy NPL, dummy HCI transport and all NimBLE sources to build
  41. SRC = \
  42. $(wildcard $(NIMBLE_ROOT)/porting/npl/dummy/src/*.c) \
  43. $(NIMBLE_SRC) \
  44. $(wildcard $(NIMBLE_ROOT)/nimble/transport/socket/src/*.c) \
  45. $(TINYCRYPT_SRC) \
  46. main.c \
  47. # Add dummy NPL and all NimBLE directories to include paths
  48. INC = \
  49. $(NIMBLE_ROOT)/porting/npl/dummy/include \
  50. $(NIMBLE_INCLUDE) \
  51. $(NIMBLE_ROOT)/nimble/transport/socket/include \
  52. $(TINYCRYPT_INCLUDE) \
  53. $(INCLUDE) \
  54. OBJ := $(SRC:.c=.o)
  55. TINYCRYPT_OBJ := $(TINYCRYPT_SRC:.c=.o)
  56. CFLAGS := $(NIMBLE_CFLAGS)
  57. LDFLAGS := $(NIMBLE_LDFLAGS)
  58. .PHONY: all clean
  59. .DEFAULT: all
  60. all: dummy
  61. clean:
  62. rm $(OBJ) -f
  63. rm dummy -f
  64. $(TINYCRYPT_OBJ): CFLAGS+=$(TINYCRYPT_CFLAGS)
  65. %.o: %.c
  66. $(CC) -c $(addprefix -I, $(INC)) $(CFLAGS) -o $@ $<
  67. dummy: $(OBJ) $(TINYCRYPT_OBJ)
  68. $(CC) -o $@ $^ $(LDFLAGS)