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 | |
| 7 | MAKE_HELPERS_DIRECTORY := ../../../make_helpers/ |
| 8 | include ${MAKE_HELPERS_DIRECTORY}build_macros.mk |
| 9 | include ${MAKE_HELPERS_DIRECTORY}build_env.mk |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 10 | include ${MAKE_HELPERS_DIRECTORY}common.mk |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 11 | include ${MAKE_HELPERS_DIRECTORY}toolchain.mk |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 12 | |
| 13 | PROJECT_1 := create_pbl${BIN_EXT} |
| 14 | OBJECTS_1 := create_pbl.o |
| 15 | PROJECT_2 := byte_swap${BIN_EXT} |
| 16 | OBJECTS_2 := byte_swap.o |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 17 | |
| 18 | override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 |
| 19 | CFLAGS := -Wall -Werror -pedantic -std=c99 |
| 20 | ifeq (${DEBUG},1) |
| 21 | CFLAGS += -g -O0 -DDEBUG |
| 22 | else |
| 23 | CFLAGS += -O2 |
| 24 | endif |
| 25 | LDLIBS := |
| 26 | |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 27 | INCLUDE_PATHS := |
| 28 | |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 29 | .PHONY: all clean distclean |
| 30 | |
| 31 | all: create_pbl byte_swap |
| 32 | |
| 33 | ${PROJECT_1}: ${OBJECTS_1} Makefile |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 34 | $(s)echo " LD $@" |
| 35 | $(q)$(host-cc) ${OBJECTS_1} -o $@ ${LDLIBS} |
| 36 | $(s)echo |
| 37 | $(s)echo "Built $@ successfully" |
| 38 | $(s)echo |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 39 | |
| 40 | ${PROJECT_2}: ${OBJECTS_2} Makefile |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 41 | $(s)echo " LD $@" |
| 42 | $(q)$(host-cc) ${OBJECTS_2} -o $@ ${LDLIBS} |
| 43 | $(s)echo |
| 44 | $(s)echo "Built $@ successfully" |
| 45 | $(s)echo |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 46 | |
| 47 | %.o: %.c %.h Makefile |
Chris Kay | 1870c72 | 2024-05-02 17:52:37 +0000 | [diff] [blame] | 48 | $(s)echo " CC $<" |
| 49 | $(q)$(host-cc) -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ |
Pankaj Gupta | e55f6c4 | 2020-12-09 14:02:39 +0530 | [diff] [blame] | 50 | |
| 51 | clean: |
| 52 | $(call SHELL_DELETE_ALL, ${PROJECT_1} ${OBJECTS_1}) |
| 53 | $(call SHELL_DELETE_ALL, ${PROJECT_2} ${OBJECTS_2}) |