Skip to content

Commit 4151368

Browse files
committed
Makefile: fix logic pulling in either terminfo .a or .so for binaries
the TI_LINKLIB target specific variable, which was intended to be overridden via "make all-dynamic" wasn't actually evaluated, and the tset and tputs binaries always linked against the static archive. since it's tricky to express this logic, we now make it conditional on whether the user puts -static in his LDFLAGS, which hints that he wants to use the static libs to compile the programs.
1 parent 5fdf288 commit 4151368

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

GNUmakefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ else
3131
ALLPIC=0
3232
endif
3333

34+
ifneq (,$(findstring -static,$(LDFLAGS)))
35+
#LDFLAGS contains -static, so the user wants to build static binaries
36+
STATIC_BINS=1
37+
else
38+
STATIC_BINS=0
39+
endif
40+
3441
CFLAGS+=-Werror-implicit-function-declaration
3542
CPPFLAGS+= -I. -I./libterminfo
3643

@@ -146,13 +153,17 @@ TP_OBJS=tput/tput.o
146153
STALIBS=$(TI_LIBA) $(CU_LIBA) $(PA_LIBA) $(ME_LIBA) $(FO_LIBA)
147154
DYNLIBS=$(TI_LIBSO) $(CU_LIBSO) $(PA_LIBSO) $(ME_LIBSO) $(FO_LIBSO)
148155
PROGS=$(TOOL_TTIC) tset/tset tput/tput
156+
157+
ifeq ($(STATIC_BINS),0)
158+
TI_LINKLIB=$(TI_LIBSO)
159+
else
149160
TI_LINKLIB=$(TI_LIBA)
161+
endif
150162

151163
all: $(STALIBS) $(DYNLIBS) $(PROGS)
152164

153165
all-static: $(STALIBS) $(PROGS)
154166

155-
all-dynamic: TI_LINKLIB=$(TI_LIBSO)
156167
all-dynamic: $(DYNLIBS) $(PROGS)
157168

158169
install-tic: $(TOOL_TTIC)

0 commit comments

Comments
 (0)