ref: e5b73212f6addcfdb5e306df63d7135e543c4f8d
src/libs/mynewt-nimble/porting/npl/linux/test/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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # * http://www.apache.org/licenses/LICENSE-2.0 # * Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. # # Makefile PROJ_ROOT = ../../../.. ### ===== Toolchain ===== CROSS_COMPILE ?= CC = ccache $(CROSS_COMPILE)gcc CPP = ccache $(CROSS_COMPILE)g++ LD = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar ### ===== Compiler Flags ===== INCLUDES = \ -I. \ -I$(PROJ_ROOT)/nimble/include \ -I$(PROJ_ROOT)/porting/npl/linux/include \ -I$(PROJ_ROOT)/porting/npl/linux/src \ -I$(PROJ_ROOT)/porting/nimble/include \ $(NULL) DEFINES = CFLAGS = \ $(INCLUDES) $(DEFINES) \ -g \ -D_GNU_SOURCE \ $(NULL) LIBS = -lrt -lpthread -lstdc++ LDFLAGS = ### ===== Sources ===== OSAL_PATH = $(PROJ_ROOT)/porting/npl/linux/src SRCS = $(shell find $(OSAL_PATH) -maxdepth 1 -name '*.c') SRCS += $(shell find $(OSAL_PATH) -maxdepth 1 -name '*.cc') SRCS += $(PROJ_ROOT)/porting/nimble/src/os_mempool.c OBJS = $(patsubst %.c, %.o,$(filter %.c, $(SRCS))) OBJS += $(patsubst %.cc,%.o,$(filter %.cc, $(SRCS))) TEST_SRCS = $(shell find . -maxdepth 1 -name '*.c') TEST_SRCS += $(shell find . -maxdepth 1 -name '*.cc') TEST_OBJS = $(patsubst %.c, %.o,$(filter %.c, $(SRCS))) TEST_OBJS += $(patsubst %.cc,%.o,$(filter %.cc, $(SRCS))) ### ===== Rules ===== all: depend \ test_npl_task.exe \ test_npl_callout.exe \ test_npl_eventq.exe \ test_npl_sem.exe \ $(NULL) test_npl_task.exe: test_npl_task.o $(OBJS) $(LD) -o $@ $^ $(LDFLAGS) $(LIBS) test_npl_eventq.exe: test_npl_eventq.o $(OBJS) $(LD) -o $@ $^ $(LDFLAGS) $(LIBS) test_npl_callout.exe: test_npl_callout.o $(OBJS) $(LD) -o $@ $^ $(LDFLAGS) $(LIBS) test_npl_sem.exe: test_npl_sem.o $(OBJS) $(LD) -o $@ $^ $(LDFLAGS) $(LIBS) test: all ./test_npl_task.exe ./test_npl_callout.exe ./test_npl_eventq.exe ./test_npl_sem.exe show_objs: @echo $(OBJS) ### ===== Clean ===== clean: @echo "Cleaning artifacts." rm *~ .depend $(OBJS) *.o *.exe ### ===== Dependencies ===== ### Rebuild if headers change depend: .depend .depend: $(SRCS) $(TEST_SRCS) @echo "Building dependencies." rm -f ./.depend $(CC) $(CFLAGS) -MM $^ > ./.depend; include .depend ### Generic rules based on extension %.o: %.c $(CC) -c $(CFLAGS) $< -o $@ %.o: %.cc $(CPP) -c $(CFLAGS) $< -o $@ |