Skip to content

Commit ccc18b9

Browse files
orbeasjaeckel
authored andcommitted
makefile.shared: Support rlibtool.
When building libtomcrypt with rlibtool instead of libtool it will fail when rlibtool fails to parse the generated libtool which does not exist. Since rlibtool should be the default choice for most slibtool users in the future this patch will use slibtool-shared instead which will correctly build the shared library. This could also help build the shared library on additional targets and hosts where the stock libtool does not have shared libraries enabled.
1 parent c9c3c42 commit ccc18b9

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

makefile.shared

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,24 @@
1616

1717
PLATFORM := $(shell uname | sed -e 's/_.*//')
1818

19+
ifeq ($(LIBTOOL),rlibtool)
20+
TGTLIBTOOL:=slibtool-shared
21+
endif
22+
1923
ifndef LIBTOOL
2024
ifeq ($(PLATFORM), Darwin)
2125
LIBTOOL:=glibtool
2226
else
2327
LIBTOOL:=libtool
2428
endif
29+
TGTLIBTOOL=$(LIBTOOL)
2530
endif
2631
ifeq ($(PLATFORM), CYGWIN)
2732
NO_UNDEFINED:=-no-undefined
2833
endif
29-
LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC)
30-
INSTALL_CMD = $(LIBTOOL) --mode=install install
31-
UNINSTALL_CMD = $(LIBTOOL) --mode=uninstall rm
34+
LTCOMPILE = $(TGTLIBTOOL) --mode=compile --tag=CC $(CC)
35+
INSTALL_CMD = $(TGTLIBTOOL) --mode=install install
36+
UNINSTALL_CMD = $(TGTLIBTOOL) --mode=uninstall rm
3237

3338
#Output filenames for various targets.
3439
ifndef LIBNAME
@@ -49,15 +54,15 @@ src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
4954
LOBJECTS = $(OBJECTS:.o=.lo)
5055

5156
$(LIBNAME): $(OBJECTS)
52-
$(LIBTOOL) --mode=link --tag=CC $(CC) $(LTC_LDFLAGS) $(LOBJECTS) $(EXTRALIBS) -o $@ -rpath $(LIBPATH) -version-info $(VERSION_LT) $(NO_UNDEFINED)
57+
$(TGTLIBTOOL) --mode=link --tag=CC $(CC) $(LTC_LDFLAGS) $(LOBJECTS) $(EXTRALIBS) -o $@ -rpath $(LIBPATH) -version-info $(VERSION_LT) $(NO_UNDEFINED)
5358

5459
test: $(call print-help,test,Builds the library and the 'test' application to run all self-tests) $(LIBNAME) $(TOBJECTS)
55-
$(LIBTOOL) --mode=link --tag=CC $(CC) $(LTC_LDFLAGS) -o $(TEST) $(TOBJECTS) $(LIBNAME) $(EXTRALIBS)
60+
$(TGTLIBTOOL) --mode=link --tag=CC $(CC) $(LTC_LDFLAGS) -o $(TEST) $(TOBJECTS) $(LIBNAME) $(EXTRALIBS)
5661

5762
# build the demos from a template
5863
define DEMO_template
5964
$(1): $(call print-help,$(1),Builds the library and the '$(1)' demo) demos/$(1).o $$(LIBNAME)
60-
$$(LIBTOOL) --mode=link --tag=CC $$(CC) $$(LTC_LDFLAGS) $$^ $$(EXTRALIBS) -o $(1)
65+
$$(TGTLIBTOOL) --mode=link --tag=CC $$(CC) $$(LTC_LDFLAGS) $$^ $$(EXTRALIBS) -o $(1)
6166
endef
6267

6368
$(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))

0 commit comments

Comments
 (0)