tools: convert makefiles to kbuild style

Before this commit, makefiles under tools/ directory
were implemented with their own way.

This commit refactors them by using "hostprogs-y" variable.

Several C sources have been added to wrap other C sources
to simplify Makefile.
For example, tools/crc32.c includes lib/crc32.c

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
This commit is contained in:
Masahiro Yamada 2014-02-04 17:24:10 +09:00 committed by Tom Rini
parent ad71fa9971
commit 940db16d2e
28 changed files with 155 additions and 364 deletions

View file

@ -8,49 +8,18 @@
# SPDX-License-Identifier: GPL-2.0+
#
include $(TOPDIR)/config.mk
BINS = gdbsend gdbcont
COBJS = gdbsend.o gdbcont.o error.o remote.o serial.o
HOSTOBJS := $(addprefix $(obj),$(COBJS))
HOSTSRCS := $(COBJS:.o=.c)
BINS := $(addprefix $(obj),$(BINS))
ifneq ($(HOSTOS),cygwin)
#
# Use native tools and options
#
HOSTCPPFLAGS = -I$(BFD_ROOT_DIR)/include
HOST_EXTRACFLAGS := -I$(BFD_ROOT_DIR)/include -pedantic
ifeq ($(HOSTOS),cygwin)
hostprogs-y := gdbsend gdbcont
all:
$(obj).depend:
gdbsend-objs := gdbsend.o error.o remote.o serial.o
gdbcont-objs := gdbcont.o error.o remote.o serial.o
else # ! CYGWIN
all: $(obj).depend $(BINS)
$(obj)gdbsend: $(obj)gdbsend.o $(obj)error.o $(obj)remote.o $(obj)serial.o
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
$(obj)gdbcont: $(obj)gdbcont.o $(obj)error.o $(obj)remote.o $(obj)serial.o
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
clean:
rm -f $(HOSTOBJS)
distclean: clean
rm -f $(BINS) $(obj)core $(obj)*.bak $(obj).depend
#########################################################################
# defines $(obj).depend target
include $(SRCTREE)/rules.mk
sinclude $(obj).depend
#########################################################################
always := $(hostprogs-y)
endif # cygwin