[vlc-commits] [Git][videolan/vlc][master] 2 commits: src: Makefile.am: split C and C++ headers
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Feb 7 16:38:02 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
01286720 by Alexandre Janniaux at 2024-02-07T16:15:05+00:00
src: Makefile.am: split C and C++ headers
Separate .h and .hpp headers in the pluginsinclude_HEADER variable to be
able to associate separate target variables for them, in particular for
the checkheader feature.
Indeed, POSIX make implementations are perfectly able to create macro
substitution and merge multiple macros together, but they are not able
to filter or substract in a general way (only one-item substraction
works) from an existing macro, so the way this should be done is by
splitting the source items and merge them where needed.
- - - - -
70c64309 by Alexandre Janniaux at 2024-02-07T16:15:05+00:00
src: Makefile.am: fix compatiblity with .hpp
The checkheaders mechanism wasn't compatible with .hpp headers, and even
more, because of substitution failure, the .hpp headers were deleted
when make distclean was run.
This commit uses the newly-separated pluginsinclude_HEADERS.h and
pluginsinclude_HEADERS.hpp variables to supply different variants for
the CHECKCOMPILE and CHECK_SOURCE_EXT variable depending on the file
type.
- - - - -
1 changed file:
- src/Makefile.am
Changes:
=====================================
src/Makefile.am
=====================================
@@ -20,7 +20,7 @@ SUFFIXES = .pc.in .pc .rc.in .rc
pluginsincludedir = $(pkgincludedir)/plugins
-pluginsinclude_HEADERS = \
+pluginsinclude_HEADERS.h = \
../include/vlc_access.h \
../include/vlc_actions.h \
../include/vlc_addons.h \
@@ -41,7 +41,6 @@ pluginsinclude_HEADERS = \
../include/vlc_config_cat.h \
../include/vlc_configuration.h \
../include/vlc_cpu.h \
- ../include/vlc_cxx_helpers.hpp \
../include/vlc_clock.h \
../include/vlc_decoder.h \
../include/vlc_demux.h \
@@ -124,6 +123,14 @@ pluginsinclude_HEADERS = \
../include/vlc_xlib.h \
../include/vlc_xml.h \
$(NULL)
+
+pluginsinclude_HEADERS.hpp = \
+ ../include/vlc_cxx_helpers.hpp \
+ $(NULL)
+
+pluginsinclude_HEADERS = \
+ $(pluginsinclude_HEADERS.h) \
+ $(pluginsinclude_HEADERS.hpp)
nodist_pluginsinclude_HEADERS = ../include/vlc_about.h
noinst_HEADERS = \
@@ -718,33 +725,46 @@ stamp-revision:
checkheader_verbose = $(checkheader_verbose_$(V))
checkheader_verbose_ = $(checkheader_verbose_$(AM_DEFAULT_VERBOSITY))
-checkheader_verbose_0 = @echo " CHECK $(@:checkheader_%_h=%.h)";
-skip_checkheader_verbose_0 = @echo " CHECK $(@:checkheader_%_h=%.h) (SKIPPED)";
checkheader_verbose__0 = $(checkheader_verbose_0)
-nodist_check_SCRIPTS = $(pluginsinclude_HEADERS:../include/%.h=checkheader_%_h)
-MOSTLYCLEANFILES += \
- $(pluginsinclude_HEADERS:../include/%.h=checkheader_%_h.c) \
- $(pluginsinclude_HEADERS:../include/%.h=checkheader_%_h.lo)
+checkheaders.h = $(pluginsinclude_HEADERS.h:../include/%=checkheader_%.check)
+checkheaders.hpp = $(pluginsinclude_HEADERS.hpp:../include/%=checkheader_%.check)
+checkheaders.all = $(checkheaders.h) $(checkheaders.hpp)
-checkheaders: $(pluginsinclude_HEADERS:../include/%.h=checkheader_%_h)
-checkheader_%_h:
- @echo "#include <stdbool.h>" > $@.c
- @echo "#include <vlc_common.h>" >> $@.c
- @echo "#include <$*.h>" >> $@.c
- $(checkheader_verbose)$(LTCOMPILE) $(CHECK_CFLAGS) -c $@.c -o $@.lo
+$(checkheaders.all): checkheader_verbose_0 = @echo " CHECK $(@:checkheader_%.check=%)";
+$(checkheaders.all): skip_checkheader_verbose_0 = @echo " CHECK $(@:checkheader_%.check=%) (SKIPPED)";
+#$(checkheaders.hpp): checkheader_verbose_0 = @echo " CHECK $(@:checkheader_%_hpp=%.hpp)";
+#$(checkheaders.hpp): skip_checkheader_verbose_0 = @echo " CHECK $(@:checkheader_%_hpp=%.hpp) (SKIPPED)";
+
+nodist_check_SCRIPTS = $(checkheaders.all)
+MOSTLYCLEANFILES += \
+ $(checkheaders.h:%=%.c) $(checkheaders.h:%=%.lo) \
+ $(checkheaders.hpp:%=%.cpp) $(checkheaders.hpp:%=%.lo)
+
+checkheaders: $(checkheaders.all)
+checkheader_%.check:
+ $(checkheader_verbose) \
+ sourcefile="$@.$(CHECKHEADER_SOURCE_EXT)"; exec 3>$${sourcefile} && \
+ echo "#include <stdbool.h>" >&3 && \
+ echo "#include <vlc_common.h>" >&3 && \
+ echo "#include <$*>" >&3 && \
+ $(CHECKCOMPILE) $(CHECK_CFLAGS) -c $${sourcefile} -o $@.lo
+$(checkheaders.h): CHECKHEADER_SOURCE_EXT=c
+$(checkheaders.h): CHECKCOMPILE=$(LTCOMPILE)
+$(checkheaders.hpp): CHECKHEADER_SOURCE_EXT=cpp
+$(checkheaders.hpp): CHECKCOMPILE=$(LTCXXCOMPILE)
# Some exceptions for headers depending on other libraries
-checkheader_vlc_gcrypt_h: CHECK_CFLAGS = "-Dgcry_check_version(x)="
-checkheader_vlc_xlib_h: CHECK_CFLAGS = $(X_CFLAGS)
+checkheader_vlc_gcrypt.h.check: CHECK_CFLAGS = "-Dgcry_check_version(x)="
+checkheader_vlc_xlib.h.check: CHECK_CFLAGS = $(X_CFLAGS)
SKIPPED_CHECKHEADERS =
if !HAVE_X
SKIPPED_CHECKHEADERS += vlc_xlib.h
endif
-$(SKIPPED_CHECKHEADERS:%.h=checkheader_%_h): checkheader_verbose_0 = $(skip_checkheader_verbose_0)
-$(SKIPPED_CHECKHEADERS:%.h=checkheader_%_h): LTCOMPILE = exit 0;
+$(SKIPPED_CHECKHEADERS:%=checkheader_%): checkheader_verbose_0 = $(skip_checkheader_verbose_0)
+$(SKIPPED_CHECKHEADERS:%=checkheader_%): CHECKCOMPILE = exit 0;
dist_check_SCRIPTS = check_headers check_symbols
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a65cd98355dd175d1fd664ab829469d91ab49091...70c643090bac6ba5c27f0cb4a68959bc8fb04380
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a65cd98355dd175d1fd664ab829469d91ab49091...70c643090bac6ba5c27f0cb4a68959bc8fb04380
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list