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 |
| 10 | |
| 11 | PROJECT_1 := create_pbl${BIN_EXT} |
| 12 | OBJECTS_1 := create_pbl.o |
| 13 | PROJECT_2 := byte_swap${BIN_EXT} |
| 14 | OBJECTS_2 := byte_swap.o |
| 15 | V ?= 0 |
| 16 | |
| 17 | override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700 |
| 18 | CFLAGS := -Wall -Werror -pedantic -std=c99 |
| 19 | ifeq (${DEBUG},1) |
| 20 | CFLAGS += -g -O0 -DDEBUG |
| 21 | else |
| 22 | CFLAGS += -O2 |
| 23 | endif |
| 24 | LDLIBS := |
| 25 | |
| 26 | ifeq (${V},0) |
| 27 | Q := @ |
| 28 | else |
| 29 | Q := |
| 30 | endif |
| 31 | |
| 32 | INCLUDE_PATHS := |
| 33 | |
| 34 | HOSTCC ?= gcc |
| 35 | CC = gcc |
| 36 | |
| 37 | .PHONY: all clean distclean |
| 38 | |
| 39 | all: create_pbl byte_swap |
| 40 | |
| 41 | ${PROJECT_1}: ${OBJECTS_1} Makefile |
| 42 | @echo " LD $@" |
| 43 | ${Q}${HOSTCC} ${OBJECTS_1} -o $@ ${LDLIBS} |
| 44 | @${ECHO_BLANK_LINE} |
| 45 | @echo "Built $@ successfully" |
| 46 | @${ECHO_BLANK_LINE} |
| 47 | |
| 48 | ${PROJECT_2}: ${OBJECTS_2} Makefile |
| 49 | @echo " LD $@" |
| 50 | ${Q}${HOSTCC} ${OBJECTS_2} -o $@ ${LDLIBS} |
| 51 | @${ECHO_BLANK_LINE} |
| 52 | @echo "Built $@ successfully" |
| 53 | @${ECHO_BLANK_LINE} |
| 54 | |
| 55 | %.o: %.c %.h Makefile |
| 56 | @echo " CC $<" |
| 57 | ${Q}${HOSTCC} -c ${CPPFLAGS} ${CFLAGS} ${INCLUDE_PATHS} $< -o $@ |
| 58 | |
| 59 | clean: |
| 60 | $(call SHELL_DELETE_ALL, ${PROJECT_1} ${OBJECTS_1}) |
| 61 | $(call SHELL_DELETE_ALL, ${PROJECT_2} ${OBJECTS_2}) |