blob: 22aa921d012e940779389e358e167b3500937c20 [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
7MAKE_HELPERS_DIRECTORY := ../../../make_helpers/
8include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
9include ${MAKE_HELPERS_DIRECTORY}build_env.mk
Chris Kay1870c722024-05-02 17:52:37 +000010include ${MAKE_HELPERS_DIRECTORY}common.mk
Chris Kayc8a47ba2023-10-20 09:17:33 +000011include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
Pankaj Guptae55f6c42020-12-09 14:02:39 +053012
13PROJECT_1 := create_pbl${BIN_EXT}
14OBJECTS_1 := create_pbl.o
15PROJECT_2 := byte_swap${BIN_EXT}
16OBJECTS_2 := byte_swap.o
Pankaj Guptae55f6c42020-12-09 14:02:39 +053017
18override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
19CFLAGS := -Wall -Werror -pedantic -std=c99
20ifeq (${DEBUG},1)
21 CFLAGS += -g -O0 -DDEBUG
22else
23 CFLAGS += -O2
24endif
25LDLIBS :=
26
Pankaj Guptae55f6c42020-12-09 14:02:39 +053027INCLUDE_PATHS :=
28
Pankaj Guptae55f6c42020-12-09 14:02:39 +053029.PHONY: all clean distclean
30
31all: create_pbl byte_swap
32
33${PROJECT_1}: ${OBJECTS_1} Makefile
Chris Kay1870c722024-05-02 17:52:37 +000034 $(s)echo " LD $@"
35 $(q)$(host-cc) ${OBJECTS_1} -o $@ ${LDLIBS}
36 $(s)echo
37 $(s)echo "Built $@ successfully"
38 $(s)echo
Pankaj Guptae55f6c42020-12-09 14:02:39 +053039
40${PROJECT_2}: ${OBJECTS_2} Makefile
Chris Kay1870c722024-05-02 17:52:37 +000041 $(s)echo " LD $@"
42 $(q)$(host-cc) ${OBJECTS_2} -o $@ ${LDLIBS}
43 $(s)echo
44 $(s)echo "Built $@ successfully"
45 $(s)echo
Pankaj Guptae55f6c42020-12-09 14:02:39 +053046
47%.o: %.c %.h Makefile
Chris Kay1870c722024-05-02 17:52:37 +000048 $(s)echo " CC $<"
49 $(q)$(host-cc) -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@
Pankaj Guptae55f6c42020-12-09 14:02:39 +053050
51clean:
52 $(call SHELL_DELETE_ALL, ${PROJECT_1} ${OBJECTS_1})
53 $(call SHELL_DELETE_ALL, ${PROJECT_2} ${OBJECTS_2})