blob: f971a74624a0f594a0e83a52e83d31a275ded5ea [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
10
11PROJECT_1 := create_pbl${BIN_EXT}
12OBJECTS_1 := create_pbl.o
13PROJECT_2 := byte_swap${BIN_EXT}
14OBJECTS_2 := byte_swap.o
15V ?= 0
16
17override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
18CFLAGS := -Wall -Werror -pedantic -std=c99
19ifeq (${DEBUG},1)
20 CFLAGS += -g -O0 -DDEBUG
21else
22 CFLAGS += -O2
23endif
24LDLIBS :=
25
26ifeq (${V},0)
27 Q := @
28else
29 Q :=
30endif
31
32INCLUDE_PATHS :=
33
34HOSTCC ?= gcc
35CC = gcc
36
37.PHONY: all clean distclean
38
39all: 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
59clean:
60 $(call SHELL_DELETE_ALL, ${PROJECT_1} ${OBJECTS_1})
61 $(call SHELL_DELETE_ALL, ${PROJECT_2} ${OBJECTS_2})