blob: b6b3b04a9519bde596c92e27b84c44d10d0d87fa [file] [log] [blame]
Pankaj Guptae55f6c42020-12-09 14:02:39 +05301#
2# Copyright 2018-2020 NXP
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
Chris Kayc8a47ba2023-10-20 09:17:33 +00007toolchains := host
8
Pankaj Guptae55f6c42020-12-09 14:02:39 +05309MAKE_HELPERS_DIRECTORY := ../../../make_helpers/
10include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
11include ${MAKE_HELPERS_DIRECTORY}build_env.mk
Chris Kayc8a47ba2023-10-20 09:17:33 +000012include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
Pankaj Guptae55f6c42020-12-09 14:02:39 +053013
14PROJECT_1 := create_pbl${BIN_EXT}
15OBJECTS_1 := create_pbl.o
16PROJECT_2 := byte_swap${BIN_EXT}
17OBJECTS_2 := byte_swap.o
18V ?= 0
19
20override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
21CFLAGS := -Wall -Werror -pedantic -std=c99
22ifeq (${DEBUG},1)
23 CFLAGS += -g -O0 -DDEBUG
24else
25 CFLAGS += -O2
26endif
27LDLIBS :=
28
29ifeq (${V},0)
30 Q := @
31else
32 Q :=
33endif
34
35INCLUDE_PATHS :=
36
Pankaj Guptae55f6c42020-12-09 14:02:39 +053037.PHONY: all clean distclean
38
39all: create_pbl byte_swap
40
41${PROJECT_1}: ${OBJECTS_1} Makefile
42 @echo " LD $@"
Chris Kay523e8642023-12-04 12:03:51 +000043 ${Q}$(host-cc) ${OBJECTS_1} -o $@ ${LDLIBS}
Pankaj Guptae55f6c42020-12-09 14:02:39 +053044 @${ECHO_BLANK_LINE}
45 @echo "Built $@ successfully"
46 @${ECHO_BLANK_LINE}
47
48${PROJECT_2}: ${OBJECTS_2} Makefile
49 @echo " LD $@"
Chris Kay523e8642023-12-04 12:03:51 +000050 ${Q}$(host-cc) ${OBJECTS_2} -o $@ ${LDLIBS}
Pankaj Guptae55f6c42020-12-09 14:02:39 +053051 @${ECHO_BLANK_LINE}
52 @echo "Built $@ successfully"
53 @${ECHO_BLANK_LINE}
54
55%.o: %.c %.h Makefile
56 @echo " CC $<"
Chris Kay523e8642023-12-04 12:03:51 +000057 ${Q}$(host-cc) -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@
Pankaj Guptae55f6c42020-12-09 14:02:39 +053058
59clean:
60 $(call SHELL_DELETE_ALL, ${PROJECT_1} ${OBJECTS_1})
61 $(call SHELL_DELETE_ALL, ${PROJECT_2} ${OBJECTS_2})