This repository has been archived by the owner on Sep 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
111 lines (89 loc) · 2.62 KB
/
Makefile
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
.SUFFIXES:
DESTDIR=
prefix=/usr/local
bindir=$(prefix)/bin
mandir=$(prefix)/man
man1dir=$(mandir)/man1
libdir=$(prefix)/lib
sharedir=$(prefix)/share
getoptdir=$(libdir)/getopt
localedir=$(sharedir)/locale
# Define this to 0 to use the getopt(3) routines in this package.
LIBCGETOPT=0
# Define this to 1 if you do not have the gettext routines
WITHOUT_GETTEXT=0
# For creating the archive
PACKAGE=getopt
VERSION=1.1.4
BASENAME=$(PACKAGE)-$(VERSION)
UNLIKELYNAME=a8vwjfd92
SHELL=/bin/sh
# CC, LD, LDFLAGS, CPPFLAGS and CFLAGS are defined in the CouchDB build script for PlayBook
#CC=gcc
#LD=ld
RM=rm -f
INSTALL=install
MSGFMT=msgfmt
LANGUAGES = cs de es fr it ja nl pt_BR
MOFILES:=$(patsubst %,po/%.mo,$(LANGUAGES))
CPPFLAGS+=-DLIBCGETOPT=$(LIBCGETOPT) -DWITH_GETTEXT=$(WITH_GETTEXT) -DLOCALEDIR=\"$(localedir)\" -DNOT_UTIL_LINUX
ifeq ($(LIBCGETOPT),0)
CPPFLAGS+=-I./gnu
endif
WARNINGS= -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual \
-Wcast-align -Wmissing-declarations \
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \
-Wnested-externs -Winline
OPTIMIZE=-O3 -fno-strength-reduce
CFLAGS+=$(WARNINGS) $(OPTIMIZE)
#LDFLAGS=
sources=getopt.c
ifeq ($(LIBCGETOPT),0)
sources+=gnu/getopt.c gnu/getopt1.c
endif
objects=$(sources:.c=.o)
binaries=getopt
.PHONY: all clean realclean
all: $(binaries) all_po
clean: clean_po
-$(RM) $(objects) $(binaries)
# Add PlayBook libraries to link against
getopt: $(objects)
$(CC) $(LDFLAGS) -o $@ -liconv -lintl $(objects)
install: getopt install_po
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
$(INSTALL) -m 755 getopt $(DESTDIR)$(bindir)
$(INSTALL) -m 644 getopt.1 $(DESTDIR)$(man1dir)
install_doc:
$(INSTALL) -m 755 -d $(DESTDIR)$(getoptdir)
$(INSTALL) -m 755 getopt-parse.bash getopt-parse.tcsh \
getopt-test.bash getopt-test.tcsh \
$(DESTDIR)$(getoptdir)
ifeq ($(WITH_GETTEXT),1)
all_po: $(MOFILES)
install_po: all_po
$(INSTALL) -m 755 -d $(DESTDIR)$(localedir)
for lang in $(LANGUAGES) ; do \
dir=$(localedir)/$$lang/LC_MESSAGES; \
$(INSTALL) -m 755 -d $(DESTDIR)$$dir ;\
$(INSTALL) -m 644 po/$$lang.mo $(DESTDIR)$$dir/getopt.mo ;\
done
clean_po:
$(RM) $(MOFILES)
else
all_po:
install_po:
clean_po:
endif
%.o: %.c
$(CC) -c $(CPPFLAGS) $(CFLAGS) $*.c -o $*.o
%.mo: %.po
$(MSGFMT) -o $@ $<
# You need GNU tar for this to work!
.PHONY: package
package: clean
$(RM) -r $(UNLIKELYNAME)
mkdir $(UNLIKELYNAME)
ln -s .. $(UNLIKELYNAME)/$(BASENAME)
cd $(UNLIKELYNAME) && tar cfvzp ../$(BASENAME).tar.gz --exclude='CVS' --exclude='*.tar.gz' --exclude=$(UNLIKELYNAME) $(BASENAME)/*
$(RM) -r $(UNLIKELYNAME)