3 # Sub-Makefile for kmk_sed.
7 # Copyright (c) 2006-2024 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
9 # This file is part of kBuild.
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.
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.
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/>
27 include $(KBUILD_PATH
)/subheader.kmk
34 kmk_sed_TEMPLATE
= BIN
36 $(kmk_sed_0_OUTDIR
)/config.h \
37 $(kmk_sed_0_OUTDIR
)/version.h \
38 $(kmk_sed_0_OUTDIR
)/stdckdint.h
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
60 kmk_sed_SOURCES.win
= \
61 ..
/lib
/startuphacks-win.c
63 kmk_sed_LIBS
= $(kmk_libsed_1_TARGET
)
64 kmk_sed_LIBS.win
= $(LIB_KUTIL
) # for stdout optimizations.
66 $(kmk_sed_0_OUTDIR
)/sys
/
68 LIBRARIES
+= kmk_libsed
69 kmk_libsed_TEMPLATE
= LIB
70 kmk_libsed_CFLAGS.solaris
= -std
=gnu99
71 kmk_libsed_DEFS
= HAVE_CONFIG_H
76 kmk_libsed_DEPS
= $(kmk_sed_DEPS
)
77 kmk_libsed_DEPS.win
= $(kmk_sed_DEPS.win
)
78 kmk_libsed_SOURCES
= \
94 lib
/version-etc-fsf.c \
104 lib
/malloc
/dynarray_resize.c \
111 kmk_libsed_SOURCES.win
= \
117 include $(FILE_KBUILD_SUB_FOOTER
)
120 # Use checked in config.h instead of running ./configure for it.
122 kmk_sed_config-
$(KBUILD_TARGET
).h
:= $(kmk_sed_DEFPATH
)/config-
$(KBUILD_TARGET
).h
124 $(kmk_sed_0_OUTDIR
)/config.h
: $(kmk_sed_config-
$(KBUILD_TARGET
).h
) |
$(call DIRDEP
,$(kmk_sed_0_OUTDIR
))
127 $(kmk_sed_0_OUTDIR
)/version.h
: |
$(call DIRDEP
,$(kmk_sed_0_OUTDIR
))
129 '#define Version "4.9"'
131 $(kmk_sed_0_OUTDIR
)/stdckdint.h
: $(kmk_sed_DEFPATH
)/lib
/stdckdint.in.h |
$(call DIRDEP
,$(kmk_sed_0_OUTDIR
))
136 # Use the regex lib shipped with sed and not anything installed on the system.
138 #$(kmk_sed_0_OUTDIR)/regex.h: $(kmk_sed_DEFPATH)/lib/regex_.h | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
142 $(kmk_sed_0_OUTDIR
)/alloca.h
: |
$(call DIRDEP
,$(kmk_sed_0_OUTDIR
))
145 "# include <malloc.h>" \
147 "# include <stdlib.h>" \
150 $(kmk_sed_0_OUTDIR
)/langinfo.h
: |
$(call DIRDEP
,$(kmk_sed_0_OUTDIR
))
154 $(kmk_sed_0_OUTDIR
)/stdbool.h
: |
$(call DIRDEP
,$(kmk_sed_0_OUTDIR
))
156 "#ifndef _STDBOOL_H" \
157 "#define _STDBOOL_H" \
158 "typedef unsigned char _Bool;" \
159 "#define bool _Bool" \
160 "#define false (0)" \
165 $(kmk_sed_0_OUTDIR
)/unistd.h
: |
$(call DIRDEP
,$(kmk_sed_0_OUTDIR
))
167 "#ifndef _UNISTD_H" \
168 "#define _UNISTD_H" \
175 $(kmk_sed_0_OUTDIR
)/getopt.h
: $(PATH_ROOT
)/src
/kmk
/getopt.h |
$(call DIRDEP
,$(kmk_sed_0_OUTDIR
))
178 $(kmk_sed_0_OUTDIR
)/sys
/random.h
: $(kmk_sed_DEFPATH
)/lib
/sys_random.in.h |
$(call DIRDEP
,$(kmk_sed_0_OUTDIR
)/sys
/)
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" \
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"/' \