-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile.static
122 lines (97 loc) · 2.74 KB
/
Makefile.static
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
112
113
114
115
116
117
118
119
120
121
122
TARGET=libgpg-error.a
CFLAGS=-m32 -I. -Isrc -Wall -O3 -DHAVE_CONFIG_H
UNAME := $(shell uname)
ifdef AWK_PROG
AWK := $(AWK_PROG)
else
AWK := $(shell which awk)
endif
ifeq ($(UNAME), Darwin)
ifeq ($(AWK),)
AWK := ../tools/osx/awk
endif
CFLAGS+=-fPIC -DHAVE_STRERROR_R=1
endif
ifeq ($(UNAME), Linux)
ifeq ($(AWK),)
$(error Please install awk for your distribution)
endif
CFLAGS+=-fPIC -DHAVE_STRERROR_R=1
endif
W32ADD=echo
WIN32=
ifeq ($(findstring CYG,$(UNAME)), CYG)
WIN32=1
CC=gcc-3
endif
ifeq ($(findstring MINGW,$(UNAME)), MINGW)
WIN32=1
CC=gcc
endif
ifdef WIN32
ifeq ($(AWK),)
AWK := ../tools/win32/gawk.exe
endif
CFLAGS+=-DWIN32 -DHAVE_W32_SYSTEM=1 -D_WIN32
W32ADD=cat src/w32-add.h
endif
genheaders= src/gpg-error.h \
src/err-sources.h \
src/err-codes.h \
src/code-to-errno.h \
src/code-from-errno.h \
src/mkerrcodes.h \
objects= src/init.o \
src/strsource.o \
src/strerror.o \
src/code-to-errno.o \
src/code-from-errno.o \
ifdef WIN32
objects+=src/w32-gettext.o
endif
all: $(TARGET)
%.o: %.c
$(CC) -o $@ $(CFLAGS) -c $<
src/gpg-error.h: src/mkheader.awk src/err-sources.h.in src/err-codes.h.in src/errnos.in src/extra-h.in src/gpg-error.h.in
$(AWK) -f src/mkheader.awk \
src/err-sources.h.in \
src/err-codes.h.in \
src/errnos.in \
src/extra-h.in \
src/gpg-error.h.in > $@
src/err-sources.h: src/mkstrtable.awk src/err-sources.h.in
$(AWK) -f src/mkstrtable.awk -v textidx=3 \
src/err-sources.h.in >$@
src/err-sources-sym.h: src/mkstrtable.awk src/err-sources.h.in
$(AWK) -f src/mkstrtable.awk -v textidx=2 -v nogettext=1 \
src/err-sources.h.in >$@
src/err-codes.h: src/mkstrtable.awk src/err-codes.h.in
$(AWK) -f src/mkstrtable.awk -v textidx=3 \
src/err-codes.h.in >$@
src/err-codes-sym.h: src/mkstrtable.awk src/err-codes.h.in
$(AWK) -f src/mkstrtable.awk -v textidx=2 -v nogettext=1 \
src/err-codes.h.in >$@
src/code-to-errno.h: src/mkerrnos.awk src/errnos.in
$(AWK) -f src/mkerrnos.awk src/errnos.in >$@
src/mkerrcodes.h: src/mkerrcodes.awk
$(AWK) -f src/mkerrcodes1.awk src/errnos.in >_mkerrcodes.h
$(CPP) _mkerrcodes.h | grep GPG_ERR_ | \
$(AWK) -f src/mkerrcodes.awk >$@
-rm _mkerrcodes.h
src/mkerrcodes: src/mkerrcodes.c src/mkerrcodes.h
$(CC) -I. -Isrc -o $@ src/mkerrcodes.c
src/code-from-errno.h: src/mkerrcodes
./src/mkerrcodes | $(AWK) -f src/mkerrcodes2.awk >$@
src/errnos-sym.h: src/mkstrtable.awk src/errnos.in
$(AWK) -f src/mkstrtable.awk -v textidx=2 -v nogettext=1 \
-v prefix=GPG_ERR_ -v namespace=errnos_ \
src/errnos.in >$@
src/extra-h.in: src/w32-add.h
@rm -f src/extra-h.in
$(W32ADD) >>src/extra-h.in
echo EOF >>src/extra-h.in
$(TARGET): $(genheaders) $(objects)
$(AR) rcs $@ $(objects)
clean:
rm -f $(objects) $(genheaders)
rm -f $(TARGET)