blob: 2bcbcba6836815e1db7962a7f0792657f9531321 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
prefix=/usr/local
bindir=$(prefix)/bin
includedir=$(prefix)/include
libdir=$(prefix)/lib
sysconfdir=$(prefix)/etc
datadir=$(prefix)/share/gettext-tiny
ifeq ($(LIBINTL), MUSL)
LIBSRC = libintl/libintl-musl.c
HEADERS =
else ifeq ($(LIBINTL), NONE)
LIBSRC =
HEADERS =
else
LIBSRC = libintl/libintl.c
HEADERS = libintl.h
endif
PROGSRC = $(sort $(wildcard src/*.c))
PARSEROBJS = src/poparser.o src/StringEscape.o
PROGOBJS = $(PROGSRC:.c=.o)
LIBOBJS = $(LIBSRC:.c=.o)
OBJS = $(PROGOBJS) $(LIBOBJS)
ALL_INCLUDES = $(HEADERS)
ifneq ($(LIBINTL), NONE)
ALL_LIBS=libintl.a
endif
ALL_TOOLS=msgfmt msgmerge xgettext autopoint
ALL_M4S=$(sort $(wildcard m4/*.m4))
CFLAGS=-O0 -fPIC
AR ?= $(CROSS_COMPILE)ar
RANLIB ?= $(CROSS_COMPILE)ranlib
CC ?= $(CROSS_COMPILE)cc
-include config.mak
BUILDCFLAGS=$(CFLAGS)
all: $(ALL_LIBS) $(ALL_TOOLS)
install: $(ALL_LIBS:lib%=$(DESTDIR)$(libdir)/lib%) $(ALL_INCLUDES:%=$(DESTDIR)$(includedir)/%) $(ALL_TOOLS:%=$(DESTDIR)$(bindir)/%) $(ALL_M4S:%=$(DESTDIR)$(datadir)/%)
clean:
rm -f $(ALL_LIBS)
rm -f $(OBJS)
rm -f $(ALL_TOOLS)
%.o: %.c
$(CC) $(BUILDCFLAGS) -c -o $@ $<
libintl.a: $(LIBOBJS)
rm -f $@
$(AR) rc $@ $(LIBOBJS)
$(RANLIB) $@
msgmerge: $(OBJS)
$(CC) $(LDFLAGS) -static -o $@ src/msgmerge.o $(PARSEROBJS)
msgfmt: $(OBJS)
$(CC) $(LDFLAGS) -static -o $@ src/msgfmt.o $(PARSEROBJS)
xgettext:
cp src/xgettext.sh ./xgettext
autopoint: src/autopoint.in
cat $< | sed 's,@datadir@,$(datadir),' > $@
$(DESTDIR)$(libdir)/%.a: %.a
install -D -m 755 $< $@
$(DESTDIR)$(includedir)/%.h: include/%.h
install -D -m 644 $< $@
$(DESTDIR)$(bindir)/%: %
install -D -m 755 $< $@
$(DESTDIR)$(datadir)/%: %
install -D -m 644 $< $@
.PHONY: all clean install
|