mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Generate event-config.h with a single sed script
This approach should make the creation of the file more atomic, to fix a bug reported by Dinh. This patch has one change from Zack's original version: it avoids $<, since Dave Hart tells me he thinks that's not so portable. (commit message by nickm)
This commit is contained in:
parent
e02222741e
commit
5859c235de
26
Makefile.am
26
Makefile.am
@ -103,6 +103,7 @@ EXTRA_DIST = \
|
||||
autogen.sh \
|
||||
event_rpcgen.py \
|
||||
libevent.pc.in \
|
||||
make-event-config.sed \
|
||||
whatsnew-2.0.txt \
|
||||
whatsnew-2.1.txt \
|
||||
$(PLATFORM_DEPENDENT_SRC)
|
||||
@ -163,27 +164,12 @@ if SIGNAL_SUPPORT
|
||||
SYS_SRC += signal.c
|
||||
endif
|
||||
|
||||
BUILT_SOURCES = ./include/event2/event-config.h
|
||||
BUILT_SOURCES = include/event2/event-config.h
|
||||
|
||||
./include/event2/event-config.h: config.h Makefile.am
|
||||
$(MKDIR_P) ./include/event2 || true
|
||||
echo '/* event2/event-config.h' > $@
|
||||
echo ' *' >> $@
|
||||
echo ' * This file was generated by autoconf when libevent was built, and post-' >> $@
|
||||
echo ' * processed by Libevent so that its macros would have a uniform prefix.' >> $@
|
||||
echo ' *' >> $@
|
||||
echo ' * DO NOT EDIT THIS FILE.' >> $@
|
||||
echo ' *' >> $@
|
||||
echo ' * Do not rely on macros in this file existing in later versions.'>> $@
|
||||
echo ' */' >> $@
|
||||
echo '#ifndef EVENT2_EVENT_CONFIG_H_INCLUDED_' >> $@
|
||||
echo '#define EVENT2_EVENT_CONFIG_H_INCLUDED_' >> $@
|
||||
|
||||
sed -e 's/#define /#define EVENT__/' \
|
||||
-e 's/#undef /#undef EVENT__/' \
|
||||
-e 's/# define /# define EVENT__/' \
|
||||
-e 's/#ifndef /#ifndef EVENT__/' < config.h >> $@
|
||||
echo "#endif" >> $@
|
||||
include/event2/event-config.h: config.h make-event-config.sed
|
||||
test -d include/event2 || $(MKDIR_P) include/event2
|
||||
$(SED) -f $(srcdir)/make-event-config.sed < config.h > $@T
|
||||
mv -f $@T $@
|
||||
|
||||
CORE_SRC = \
|
||||
buffer.c \
|
||||
|
23
make-event-config.sed
Normal file
23
make-event-config.sed
Normal file
@ -0,0 +1,23 @@
|
||||
# Sed script to postprocess config.h into event-config.h.
|
||||
|
||||
1i\
|
||||
/* event2/event-config.h\
|
||||
*\
|
||||
* This file was generated by autoconf when libevent was built, and post-\
|
||||
* processed by Libevent so that its macros would have a uniform prefix.\
|
||||
*\
|
||||
* DO NOT EDIT THIS FILE.\
|
||||
*\
|
||||
* Do not rely on macros in this file existing in later versions.\
|
||||
*/\
|
||||
\
|
||||
#ifndef EVENT2_EVENT_CONFIG_H_INCLUDED_\
|
||||
#define EVENT2_EVENT_CONFIG_H_INCLUDED_\
|
||||
|
||||
$a\
|
||||
\
|
||||
#endif /* event2/event-config.h */
|
||||
|
||||
s/#\( *\)define /#\1define EVENT__/
|
||||
s/#\( *\)undef /#\1undef EVENT__/
|
||||
s/#\( *\)if\(n*\)def /#\1if\2def EVENT__/
|
Loading…
x
Reference in New Issue
Block a user