summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxhe <xw897002528@gmail.com>2018-07-14 18:59:23 +0800
committerxhe <xw897002528@gmail.com>2018-07-14 19:11:51 +0800
commit1a4dc39864ff80c5fb2464b16c4609593c34ae69 (patch)
treeefb1fe0bdd35f71d8b3ae2bc4147d913171fcbfc
parent7698cca6d5634ce0de4bb382e0535e1f02d7fb17 (diff)
downloadgettext-tiny-1a4dc39864ff80c5fb2464b16c4609593c34ae69.tar.gz
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.
-rw-r--r--Makefile5
1 files changed, 3 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 927d02e..6a7c1a4 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,7 @@ ALL_M4S=$(sort $(wildcard m4/*.m4))
ALL_DATA=$(sort $(wildcard data/*))
CFLAGS=-O0 -fPIC
+LDLIBS=-liconv
AR ?= $(CROSS_COMPILE)ar
RANLIB ?= $(CROSS_COMPILE)ranlib
@@ -62,10 +63,10 @@ libintl.a: $(LIBOBJS)
$(RANLIB) $@
msgmerge: $(OBJS)
- $(CC) $(LDFLAGS) -static -o $@ src/msgmerge.o $(PARSEROBJS)
+ $(CC) $(LDFLAGS) -static -o $@ src/msgmerge.o $(PARSEROBJS) $(LDLIBS)
msgfmt: $(OBJS)
- $(CC) $(LDFLAGS) -static -o $@ src/msgfmt.o $(PARSEROBJS)
+ $(CC) $(LDFLAGS) -static -o $@ src/msgfmt.o $(PARSEROBJS) $(LDLIBS)
xgettext:
cp src/xgettext.sh ./xgettext