summaryrefslogtreecommitdiff
path: root/pc/Makefile.ext
blob: cf4e7a89f81c204c327679560bf432d113def7dc (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
# extension/Makefile for the MinGW build
#
# Copyright (C) 2013, 2015, 2017, 2023 Free Software Foundation, Inc.

# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

prefix = c:/gnu
pkgdatadir = $(prefix)/lib/awk
pkgextensiondir = $(prefix)/lib/gawk
includedir = $(prefix)/include
libdir = $(prefix)/lib
datadir = $(prefix)/share
pkgdatadir = $(datadir)/gawk-extensions
pkgincludedir = $(includedir)/gawk-extensions
pkglibdir = $(libdir)/gawk-extensions
pkglibexecdir = $(libexecdir)/gawk-extensions

SOEXT = dll

MPFR = -DHAVE_MPFR
MPFR_LIBS = -lmpfr -lgmp

SIMPLE_EXTENSIONS = inplace.$(SOEXT) ordchr.$(SOEXT) readfile.$(SOEXT)\
 revoutput.$(SOEXT) revtwoway.$(SOEXT) testext.$(SOEXT)
ALL_EXTENSIONS = filefuncs.$(SOEXT) fnmatch.$(SOEXT) inplace.$(SOEXT)\
 intdiv.$(SOEXT) ordchr.$(SOEXT) readdir.$(SOEXT) readfile.$(SOEXT) \
 revoutput.$(SOEXT) readdir_test.$(SOEXT) revtwoway.$(SOEXT) rwarray.$(SOEXT) \
 testext.$(SOEXT) time.$(SOEXT)

extensions: $(ALL_EXTENSIONS)

fnmatch.$(SOEXT): fnmatch.c
	gcc -I.. -I../missing_d -DHAVE_FNMATCH_H -shared -gdwarf-2 -g3 -static-libgcc -o $@ fnmatch.c

intdiv.$(SOEXT): intdiv.c
	gcc -I.. $(MPFR) -shared -gdwarf-2 -g3 -static-libgcc -o $@ intdiv.c $(MPFR_LIBS)

readdir.$(SOEXT): readdir.c gawkdirfd.h
	gcc -I.. -DHAVE_DIRENT_H -shared -gdwarf-2 -g3 -static-libgcc -o $@ readdir.c

readdir_test.$(SOEXT): readdir_test.c gawkdirfd.h
	gcc -I.. -DHAVE_DIRENT_H -shared -gdwarf-2 -g3 -static-libgcc -o $@ readdir_test.c

rwarray.$(SOEXT): rwarray.c
	gcc -I.. -shared -gdwarf-2 -g3 -static-libgcc -o $@ rwarray.c -lws2_32

filefuncs.$(SOEXT): filefuncs.c stack.c stack.h gawkfts.h
	gcc -I.. -shared -gdwarf-2 -g3 -static-libgcc -o $@ filefuncs.c stack.c

time.$(SOEXT): time.c
	gcc -DHAVE_GETSYSTEMTIMEASFILETIME -I.. -shared -gdwarf-2 -g3 -static-libgcc -o $@ time.c

$(SIMPLE_EXTENSIONS):
	gcc -I.. -shared -gdwarf-2 -g3 -static-libgcc -o $@ $(@:.$(SOEXT)=.c)

$(ALL_EXTENSIONS): ../gawkapi.h ../gettext.h

inplace.$(SOEXT): inplace.c
ordchr.$(SOEXT): ordchr.c
readfile.$(SOEXT): readfile.c
revoutput.$(SOEXT): revoutput.c
rwarray.$(SOEXT): rwarray.c
testext.$(SOEXT): testext.c
time.$(SOEXT): time.c

# This must not be called 'install' because there's a file INSTALL,
# and case-insensitive filesystems will gladly accept it.
install-extensions:
	-mkdir "$(pkgextensiondir)"
	cp *.$(SOEXT) "$(pkgextensiondir)"
	-mkdir "$(prefix)/share/man/man3"
	cp *.3am "$(prefix)/share/man/man3"

install-strip: install-extensions
	strip --strip-unneeded "$(pkgextensiondir)"/*.$(SOEXT)

clean:
	-rm -f *.$(SOEXT)