Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 1 | # |
| 2 | # Copyright 2018-2020 NXP |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 7 | toolchains := host |
| 8 | |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 9 | MAKE_HELPERS_DIRECTORY := ../../../make_helpers/ |
| 10 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
| 11 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 12 | include ${MAKE_HELPERS_DIRECTORY}toolchain.mk |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 13 | |
| 14 | PROJECT_1 := create_pbl${BIN_EXT} |
| 15 | OBJECTS_1 := create_pbl.o |
| 16 | PROJECT_2 := byte_swap${BIN_EXT} |
| 17 | OBJECTS_2 := byte_swap.o |
| 18 | V ?= 0 |
| 19 | |
| 20 | override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 |
| 21 | CFLAGS := -Wall -Werror -pedantic -std=c99 |
| 22 | ifeq (${DEBUG},1) |
| 23 | CFLAGS += -g -O0 -DDEBUG |
| 24 | else |
| 25 | CFLAGS += -O2 |
| 26 | endif |
| 27 | LDLIBS := |
| 28 | |
| 29 | ifeq (${V},0) |
| 30 | Q := @ |
| 31 | else |
| 32 | Q := |
| 33 | endif |
| 34 | |
| 35 | INCLUDE_PATHS := |
| 36 | |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 37 | .PHONY: all clean distclean |
| 38 | |
| 39 | all: create_pbl byte_swap |
| 40 | |
| 41 | ${PROJECT_1}: ${OBJECTS_1} Makefile |
| 42 | @echo " LD $@" |
Chris Kay | 523e864 | 2023-12-04 12:03:51 +0000 | [diff] [blame] | 43 | ${Q}$(host-cc) ${OBJECTS_1} -o $@ ${LDLIBS} |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 44 | @${ECHO_BLANK_LINE} |
| 45 | @echo "Built $@ successfully" |
| 46 | @${ECHO_BLANK_LINE} |
| 47 | |
| 48 | ${PROJECT_2}: ${OBJECTS_2} Makefile |
| 49 | @echo " LD $@" |
Chris Kay | 523e864 | 2023-12-04 12:03:51 +0000 | [diff] [blame] | 50 | ${Q}$(host-cc) ${OBJECTS_2} -o $@ ${LDLIBS} |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 51 | @${ECHO_BLANK_LINE} |
| 52 | @echo "Built $@ successfully" |
| 53 | @${ECHO_BLANK_LINE} |
| 54 | |
| 55 | %.o: %.c %.h Makefile |
| 56 | @echo " CC $<" |
Chris Kay | 523e864 | 2023-12-04 12:03:51 +0000 | [diff] [blame] | 57 | ${Q}$(host-cc) -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 58 | |
| 59 | clean: |
| 60 | $(call SHELL_DELETE_ALL, ${PROJECT_1} ${OBJECTS_1}) |
| 61 | $(call SHELL_DELETE_ALL, ${PROJECT_2} ${OBJECTS_2}) |