1 | # $Id: Makefile.kmk 3646 2024-11-03 02:33:14Z bird $
|
---|
2 | ## @file
|
---|
3 | # Sub-Makefile for kmk_sed.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2006-2024 knut st. osmundsen <[email protected]>
|
---|
8 | #
|
---|
9 | # This file is part of kBuild.
|
---|
10 | #
|
---|
11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU General Public License as published by
|
---|
13 | # the Free Software Foundation; either version 3 of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # kBuild is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with kBuild. If not, see <http://www.gnu.org/licenses/>
|
---|
23 | #
|
---|
24 | #
|
---|
25 |
|
---|
26 | SUB_DEPTH = ../..
|
---|
27 | include $(KBUILD_PATH)/subheader.kmk
|
---|
28 |
|
---|
29 | #
|
---|
30 | # kmk_sed
|
---|
31 | #
|
---|
32 | PROGRAMS += kmk_sed
|
---|
33 |
|
---|
34 | kmk_sed_TEMPLATE = BIN
|
---|
35 | kmk_sed_DEPS = \
|
---|
36 | $(kmk_sed_0_OUTDIR)/config.h \
|
---|
37 | $(kmk_sed_0_OUTDIR)/version.h \
|
---|
38 | $(kmk_sed_0_OUTDIR)/stdckdint.h
|
---|
39 | kmk_sed_DEPS.win = \
|
---|
40 | $(kmk_sed_0_OUTDIR)/alloca.h \
|
---|
41 | $(kmk_sed_0_OUTDIR)/getopt.h \
|
---|
42 | $(kmk_sed_0_OUTDIR)/unistd.h \
|
---|
43 | $(kmk_sed_0_OUTDIR)/langinfo.h \
|
---|
44 | $(kmk_sed_0_OUTDIR)/sys/random.h
|
---|
45 | kmk_sed_CLEAN = $(kmk_sed_DEPS)
|
---|
46 | kmk_sed_CFLAGS.solaris = -std=gnu99
|
---|
47 | kmk_sed_INCS = \
|
---|
48 | $(kmk_sed_0_OUTDIR) \
|
---|
49 | . \
|
---|
50 | lib
|
---|
51 | kmk_sed_SOURCES = \
|
---|
52 | sed/sed.c \
|
---|
53 | sed/debug.c \
|
---|
54 | sed/compile.c \
|
---|
55 | sed/execute.c \
|
---|
56 | sed/mbcs.c \
|
---|
57 | sed/regexp.c \
|
---|
58 | sed/utils.c
|
---|
59 |
|
---|
60 | kmk_sed_SOURCES.win = \
|
---|
61 | ../lib/startuphacks-win.c
|
---|
62 |
|
---|
63 | kmk_sed_LIBS = $(kmk_libsed_1_TARGET)
|
---|
64 | kmk_sed_LIBS.win = $(LIB_KUTIL) # for stdout optimizations.
|
---|
65 | kmk_sed_BLDDIRS = \
|
---|
66 | $(kmk_sed_0_OUTDIR)/sys/
|
---|
67 |
|
---|
68 | LIBRARIES += kmk_libsed
|
---|
69 | kmk_libsed_TEMPLATE = LIB
|
---|
70 | kmk_libsed_CFLAGS.solaris = -std=gnu99
|
---|
71 | kmk_libsed_DEFS = HAVE_CONFIG_H
|
---|
72 | kmk_libsed_INCS = \
|
---|
73 | $(kmk_sed_0_OUTDIR) \
|
---|
74 | . \
|
---|
75 | lib
|
---|
76 | kmk_libsed_DEPS = $(kmk_sed_DEPS)
|
---|
77 | kmk_libsed_DEPS.win = $(kmk_sed_DEPS.win)
|
---|
78 | kmk_libsed_SOURCES = \
|
---|
79 | lib/basename-lgpl.c \
|
---|
80 | lib/binary-io.c \
|
---|
81 | lib/c-ctype.c \
|
---|
82 | lib/c-strcasecmp.c \
|
---|
83 | lib/c-strncasecmp.c \
|
---|
84 | lib/close-stream.c \
|
---|
85 | lib/closeout.c \
|
---|
86 | lib/dirname-lgpl.c \
|
---|
87 | lib/progname.c \
|
---|
88 | lib/getprogname.c \
|
---|
89 | lib/obstack.c \
|
---|
90 | lib/localcharset.c \
|
---|
91 | lib/localeinfo.c \
|
---|
92 | lib/xalloc-die.c \
|
---|
93 | lib/xmalloc.c \
|
---|
94 | lib/version-etc-fsf.c \
|
---|
95 | lib/version-etc.c \
|
---|
96 | lib/strverscmp.c \
|
---|
97 | lib/dfa.c \
|
---|
98 | lib/regex.c \
|
---|
99 | lib/fwriting.c \
|
---|
100 | lib/mkostemp.c \
|
---|
101 | lib/getdelim.c \
|
---|
102 | lib/reallocarray.c \
|
---|
103 | lib/exitfail.c \
|
---|
104 | lib/malloc/dynarray_resize.c \
|
---|
105 | lib/tempname.c \
|
---|
106 | lib/error.c \
|
---|
107 | \
|
---|
108 | ../kmk/getopt.c \
|
---|
109 | ../kmk/getopt1.c
|
---|
110 |
|
---|
111 | kmk_libsed_SOURCES.win = \
|
---|
112 | lib/memrchr.c \
|
---|
113 | lib/getrandom.c \
|
---|
114 | lib/mkdir.c \
|
---|
115 | lib/stripslash.c
|
---|
116 |
|
---|
117 | include $(FILE_KBUILD_SUB_FOOTER)
|
---|
118 |
|
---|
119 | #
|
---|
120 | # Use checked in config.h instead of running ./configure for it.
|
---|
121 | #
|
---|
122 | kmk_sed_config-$(KBUILD_TARGET).h := $(kmk_sed_DEFPATH)/config-$(KBUILD_TARGET).h
|
---|
123 |
|
---|
124 | $(kmk_sed_0_OUTDIR)/config.h: $(kmk_sed_config-$(KBUILD_TARGET).h) | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
|
---|
125 | $(CP) -f $^ $@
|
---|
126 |
|
---|
127 | $(kmk_sed_0_OUTDIR)/version.h: | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
|
---|
128 | $(APPEND) -tn "$@" \
|
---|
129 | '#define Version "4.9"'
|
---|
130 |
|
---|
131 | $(kmk_sed_0_OUTDIR)/stdckdint.h: $(kmk_sed_DEFPATH)/lib/stdckdint.in.h | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
|
---|
132 | $(CP) -f $^ $@
|
---|
133 |
|
---|
134 |
|
---|
135 | #
|
---|
136 | # Use the regex lib shipped with sed and not anything installed on the system.
|
---|
137 | #
|
---|
138 | #$(kmk_sed_0_OUTDIR)/regex.h: $(kmk_sed_DEFPATH)/lib/regex_.h | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
|
---|
139 | # $(CP) -f $^ $@
|
---|
140 |
|
---|
141 |
|
---|
142 | $(kmk_sed_0_OUTDIR)/alloca.h: | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
|
---|
143 | $(APPEND) -tn "$@" \
|
---|
144 | "#ifdef _MSC_VER" \
|
---|
145 | "# include <malloc.h>" \
|
---|
146 | "#else" \
|
---|
147 | "# include <stdlib.h>" \
|
---|
148 | "#endif"
|
---|
149 |
|
---|
150 | $(kmk_sed_0_OUTDIR)/langinfo.h: | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
|
---|
151 | $(APPEND) -tn "$@" \
|
---|
152 | ""
|
---|
153 |
|
---|
154 | $(kmk_sed_0_OUTDIR)/stdbool.h: | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
|
---|
155 | $(APPEND) -tn "$@" \
|
---|
156 | "#ifndef _STDBOOL_H" \
|
---|
157 | "#define _STDBOOL_H" \
|
---|
158 | "typedef unsigned char _Bool;" \
|
---|
159 | "#define bool _Bool" \
|
---|
160 | "#define false (0)" \
|
---|
161 | "#define true (1)" \
|
---|
162 | "#endif"
|
---|
163 |
|
---|
164 |
|
---|
165 | $(kmk_sed_0_OUTDIR)/unistd.h: | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
|
---|
166 | $(APPEND) -tn "$@" \
|
---|
167 | "#ifndef _UNISTD_H" \
|
---|
168 | "#define _UNISTD_H" \
|
---|
169 | "#ifdef _MSC_VER" \
|
---|
170 | "# include <io.h>" \
|
---|
171 | "#endif" \
|
---|
172 | "#endif"
|
---|
173 |
|
---|
174 |
|
---|
175 | $(kmk_sed_0_OUTDIR)/getopt.h: $(PATH_ROOT)/src/kmk/getopt.h | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
|
---|
176 | $(CP) -f "$^" "$@"
|
---|
177 |
|
---|
178 | $(kmk_sed_0_OUTDIR)/sys/random.h: $(kmk_sed_DEFPATH)/lib/sys_random.in.h | $(call DIRDEP,$(kmk_sed_0_OUTDIR)/sys/)
|
---|
179 | $(RM) -f "$@"
|
---|
180 | $(SED) \
|
---|
181 | -e "s/@GUARD_PREFIX@/GNULIB_/g" \
|
---|
182 | -e "s/@PRAGMA_SYSTEM_HEADER@//g" \
|
---|
183 | -e "s/@PRAGMA_COLUMNS@//g" \
|
---|
184 | -e "s/# *@INCLUDE_NEXT@.*//g" \
|
---|
185 | \
|
---|
186 | -e "s/@HAVE_SYS_RANDOM_H@/0/g" \
|
---|
187 | -e "s/@GNULIB_GETRANDOM@/1/g" \
|
---|
188 | -e "s/@REPLACE_GETRANDOM@/0/g" \
|
---|
189 | -e "s/@HAVE_GETRANDOM@/0/g" \
|
---|
190 | -e 's/.*The definitions of _GL_FUNCDECL_RPL.*/$(HASH)include "c++defs.h"/' \
|
---|
191 | -e 's/.*The definitions of _GL_ARG_NONNULL.*/$(HASH)include "arg-nonnull.h"/' \
|
---|
192 | -e 's/.*The definitions of _GL_WARN_ON_USE.*/$(HASH)include "warn-on-use.h"/' \
|
---|
193 | \
|
---|
194 | --output "$@" "$<"
|
---|
195 |
|
---|