Skip to content

Commit 1a4dc39

Browse files
committed
makefile: add LDLIBS to handle -liconv correctly
The previous commit was done with mingw. And it can not be compiled at first. Gcc told me he can not find libiconv even if i added -liconv into LDFLAGS. https://stackoverflow.com/questions/13249610/how-to-use-ldflags-in-makefile , and i found this article. The original position of LDFLAGS seems to only be considered at the compiling stage. But what we gonna go through is the linking stage, which makes -lxxx in LDFLAGS useless. So i added LDLIBS to the end of line. By the way, -liconv is set by default for compatibility. And mingw now works well with gettext-tiny.
1 parent 7698cca commit 1a4dc39

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ ALL_M4S=$(sort $(wildcard m4/*.m4))
3333
ALL_DATA=$(sort $(wildcard data/*))
3434

3535
CFLAGS=-O0 -fPIC
36+
LDLIBS=-liconv
3637

3738
AR ?= $(CROSS_COMPILE)ar
3839
RANLIB ?= $(CROSS_COMPILE)ranlib
@@ -62,10 +63,10 @@ libintl.a: $(LIBOBJS)
6263
$(RANLIB) $@
6364

6465
msgmerge: $(OBJS)
65-
$(CC) $(LDFLAGS) -static -o $@ src/msgmerge.o $(PARSEROBJS)
66+
$(CC) $(LDFLAGS) -static -o $@ src/msgmerge.o $(PARSEROBJS) $(LDLIBS)
6667

6768
msgfmt: $(OBJS)
68-
$(CC) $(LDFLAGS) -static -o $@ src/msgfmt.o $(PARSEROBJS)
69+
$(CC) $(LDFLAGS) -static -o $@ src/msgfmt.o $(PARSEROBJS) $(LDLIBS)
6970

7071
xgettext:
7172
cp src/xgettext.sh ./xgettext

0 commit comments

Comments
 (0)