zephyr/samples/application_development/external_lib/mylib/Makefile
Jamie McCrae cb50f2fb16 samples: external_lib: Add building on windows support
Adds support for building the external_lib sample application on a
windows host operating system.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2022-11-30 16:35:40 +01:00

27 lines
535 B
Makefile

#
# Copyright (c) 2017 Intel Corporation
# Copyright (c) 2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
#
PREFIX ?= .
OBJ_DIR ?= $(PREFIX)/obj
LIB_DIR ?= $(PREFIX)/lib
ifeq ($(findstring Windows, $(OS)),Windows)
DEL := rmdir /S /Q
MKDIR := mkdir
else
DEL := rm -rf
MKDIR := mkdir -p
endif
all:
-$(MKDIR) "$(OBJ_DIR)"
-$(MKDIR) "$(LIB_DIR)"
$(CC) -c $(CFLAGS) -MD -Iinclude src/mylib.c -o $(OBJ_DIR)/mylib.o
$(AR) -rcs $(LIB_DIR)/libmylib.a $(OBJ_DIR)/mylib.o
clean:
$(DEL) "$(OBJ_DIR)" "$(LIB_DIR)"