-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (41 loc) · 1.42 KB
/
Copy pathMakefile
File metadata and controls
50 lines (41 loc) · 1.42 KB
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
.PHONY: build lib examples docker-run install clean
TARGET ?= POSIX
#TARGET ?= RASPBERRY-PI-3
#TARGET ?= STM32H747I-DISCO
#DOCKER_FILE ?= dockerfile.ubuntu
#DOCKER_FILE ?= dockerfile.debian
DOCKER_FILE ?= dockerfile.fedora
build: lib examples
lib:
mkdir -p build/lib
ifeq ($(TARGET),POSIX)
cd build/lib && cmake ../.. && make -j$(shell nproc || echo 2)
else
cd build/lib && make all -f ../../scripts/gmake/$(TARGET)/library.mk -j$(shell nproc || echo 2)
cd build/lib && make all -f ../../scripts/gmake/$(TARGET)/tests.mk -j$(shell nproc || echo 2)
endif
examples:
mkdir -p build/examples
ifeq ($(TARGET),POSIX)
cd build/examples && cmake ../../examples/POSIX && make -j$(shell nproc || echo 2)
else
cd build/examples && make all -f ../../examples/$(TARGET)/Makefile -j$(shell nproc || echo 2)
endif
docker-build: scripts/docker/$(DOCKER_FILE)
cd scripts/docker && docker build -t lib-coap-cpp-image --rm -f $(DOCKER_FILE) ../..
docker-run:
docker run --name=coap-container --rm -i -t lib-coap-cpp-image bash
install:
ifeq ($(TARGET),POSIX)
mkdir -p /usr/local/include/coapcpp
cp -R include/* /usr/local/include/coapcpp
cp build/lib/libcoapcpp.a /usr/local/lib
endif
clean:
ifeq ($(TARGET),POSIX)
rm -rf build
else
cd build/lib && make clean -f ../../scripts/gmake/$(TARGET)/library.mk
cd build/lib && make clean -f ../../scripts/gmake/$(TARGET)/tests.mk
cd build/examples && make clean -f ../../examples/$(TARGET)/Makefile
endif