Skip to content

Commit 0dc1fc2

Browse files
API: Convert conditional building to the new scheme.
This fixes a build breakage with CONFIG_API enabled, which appeared after the recent changes in the U-Boot build system. Signed-off-by: Rafal Jaworowski <[email protected]>
1 parent 98b7424 commit 0dc1fc2

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

Makefile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,7 @@ LIBS += $(shell if [ -d post/board/$(BOARDDIR) ]; then echo \
253253
"post/board/$(BOARDDIR)/libpost$(BOARD).a"; fi)
254254
LIBS += common/libcommon.a
255255
LIBS += libfdt/libfdt.a
256-
ifeq ($(CONFIG_API),y)
257256
LIBS += api/libapi.a
258-
endif
259257

260258
LIBS := $(addprefix $(obj),$(LIBS))
261259
.PHONY : $(LIBS)
@@ -266,11 +264,8 @@ PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -
266264
# The "tools" are needed early, so put this first
267265
# Don't include stuff already done in $(LIBS)
268266
SUBDIRS = tools \
269-
examples
270-
271-
ifeq ($(CONFIG_API),y)
272-
SUBDIRS += api_examples
273-
endif
267+
examples \
268+
api_examples
274269

275270
.PHONY : $(SUBDIRS)
276271

api/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ include $(TOPDIR)/config.mk
2424

2525
LIB = $(obj)libapi.a
2626

27-
COBJS = api.o api_net.o api_storage.o api_platform-$(ARCH).o
27+
COBJS-$(CONFIG_API) += api.o api_net.o api_storage.o api_platform-$(ARCH).o
2828

29+
COBJS := $(COBJS-y)
2930
SRCS := $(COBJS:.o=.c)
3031
OBJS := $(addprefix $(obj),$(COBJS))
3132

32-
all: $(LIB)
33-
3433
$(LIB): $(obj).depend $(OBJS)
3534
$(AR) $(ARFLAGS) $@ $(OBJS)
3635

api_examples/Makefile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,25 @@ endif
3030

3131
include $(TOPDIR)/config.mk
3232

33-
ELF += demo
34-
BIN += demo.bin
33+
ELF-$(CONFIG_API) += demo
34+
BIN-$(CONFIG_API) += demo.bin
35+
ELF := $(ELF-y)
36+
BIN := $(BIN-y)
3537

3638
#CFLAGS += -v
3739

38-
COBJS := $(ELF:=.o)
39-
SOBJS := crt0.o
40+
COBJS-$(CONFIG_API) += $(ELF:=.o)
41+
SOBJS-$(CONFIG_API) += crt0.o
4042
ifeq ($(ARCH),ppc)
41-
SOBJS += ppcstring.o
43+
SOBJS-$(CONFIG_API) += ppcstring.o
4244
endif
45+
COBJS := $(COBJS-y)
46+
SOBJS := $(SOBJS-y)
4347

4448
LIB = $(obj)libglue.a
45-
LIBCOBJS= glue.o crc32.o ctype.o string.o vsprintf.o libgenwrap.o
49+
LIBCOBJS-$(CONFIG_API) += glue.o crc32.o ctype.o string.o vsprintf.o \
50+
libgenwrap.o
51+
LIBCOBJS := $(LIBCOBJS-y)
4652

4753
LIBOBJS = $(addprefix $(obj),$(SOBJS) $(LIBCOBJS))
4854

@@ -55,7 +61,7 @@ gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
5561

5662
CPPFLAGS += -I..
5763

58-
all: $(obj).depend $(OBJS) $(LIB) $(BIN) $(ELF)
64+
all: $(obj).depend $(OBJS) $(LIB) $(ELF) $(BIN)
5965

6066
#########################################################################
6167
$(LIB): $(obj).depend $(LIBOBJS)

0 commit comments

Comments
 (0)