Skip to content

Commit dd131c1

Browse files
committed
make it possible to do static/dynamic builds/installs only
the all-static and install-static makefile targets can be used to build or install only the static libs, and all-dynamic/install-dynamic vice versa for dynamic libs only. if one wants the programs (tset, tput, tic) to be *entirely* static linked (i.e. not only against libterminfo but also against libc), -static has to be added to LDFLAGS by the user, either by putting it into config.mak or passing it to the make invocation. closes sabotage-linux#5
1 parent aadc2a6 commit dd131c1

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

GNUmakefile

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,17 @@ TS_OBJS=$(TS_SRCS:.c=.o)
147147
TP_SRCS=tput/tput.c
148148
TP_OBJS=tput/tput.o
149149

150-
all: $(TOOL_TTIC) $(TI_LIBA) $(CU_LIBA) $(CU_LIBSO) $(TI_LIBSO) $(PA_LIBA) $(PA_LIBSO) $(ME_LIBA) $(ME_LIBSO) $(FO_LIBA) $(FO_LIBSO) tset/tset tput/tput
150+
STALIBS=$(TI_LIBA) $(CU_LIBA) $(PA_LIBA) $(ME_LIBA) $(FO_LIBA)
151+
DYNLIBS=$(TI_LIBSO) $(CU_LIBSO) $(PA_LIBSO) $(ME_LIBSO) $(FO_LIBSO)
152+
PROGS=$(TOOL_TTIC) tset/tset tput/tput
153+
TI_LINKLIB=$(TI_LIBA)
154+
155+
all: $(STALIBS) $(DYNLIBS) $(PROGS)
156+
157+
all-static: $(STALIBS) $(PROGS)
158+
159+
all-dynamic: TI_LINKLIB=$(TI_LIBSO)
160+
all-dynamic: $(DYNLIBS) $(PROGS)
151161

152162
install-tic: $(TOOL_TTIC)
153163
$(INSTALL) -Dm 755 $(TOOL_TTIC) $(DESTDIR)$(BINDIR)/tic
@@ -258,6 +268,10 @@ install-pcs: install-pc-form install-pc-menu install-pc-panel install-pc-terminf
258268

259269
install: install-headers install-libs install-progs install-pcs
260270

271+
install-static: install-headers install-progs install-pcs install-stalibs
272+
install-dynamic: TI_LINKLIB=$(TI_LIBSO)
273+
install-dynamic: install-headers install-progs install-pcs install-dynlibs
274+
261275
# TODO: gen (if necessary) and install manpages
262276

263277
clean:
@@ -273,13 +287,13 @@ clean:
273287
$(TOOL_NBPERF): $(NBPERF_OBJS)
274288
$(HOSTCC) $(LDFLAGS_HOST) $^ -o $@
275289

276-
tset/tset: $(TI_LIBA)
290+
tset/tset: $(TI_LINKLIB)
277291
tset/tset: $(TS_OBJS)
278-
$(CC) -o $@ $^ -L./libterminfo -lterminfo -static
292+
$(CC) -o $@ $^ -L./libterminfo -lterminfo $(LDFLAGS)
279293

280-
tput/tput: $(TI_LIBA)
294+
tput/tput: $(TI_LINKLIB)
281295
tput/tput: $(TP_OBJS)
282-
$(CC) -o $@ $^ -L./libterminfo -lterminfo -static
296+
$(CC) -o $@ $^ -L./libterminfo -lterminfo $(LDFLAGS)
283297

284298
tset/%.o: tset/%.c
285299
$(CC) $(CPPFLAGS) -I./tset -I. -I./libterminfo $(CFLAGS) -c -o $@ $<

0 commit comments

Comments
 (0)