Skip to content

Commit

Permalink
Makefile: fix logic pulling in either terminfo .a or .so for binaries
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rofl0r committed Mar 22, 2016
1 parent 5fdf288 commit 4151368
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ else
ALLPIC=0
endif

ifneq (,$(findstring -static,$(LDFLAGS)))
#LDFLAGS contains -static, so the user wants to build static binaries
STATIC_BINS=1
else
STATIC_BINS=0
endif

CFLAGS+=-Werror-implicit-function-declaration
CPPFLAGS+= -I. -I./libterminfo

Expand Down Expand Up @@ -146,13 +153,17 @@ TP_OBJS=tput/tput.o
STALIBS=$(TI_LIBA) $(CU_LIBA) $(PA_LIBA) $(ME_LIBA) $(FO_LIBA)
DYNLIBS=$(TI_LIBSO) $(CU_LIBSO) $(PA_LIBSO) $(ME_LIBSO) $(FO_LIBSO)
PROGS=$(TOOL_TTIC) tset/tset tput/tput

ifeq ($(STATIC_BINS),0)
TI_LINKLIB=$(TI_LIBSO)
else
TI_LINKLIB=$(TI_LIBA)
endif

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

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

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

install-tic: $(TOOL_TTIC)
Expand Down

0 comments on commit 4151368

Please sign in to comment.