VirtualBox

Changeset 68676 in vbox


Ignore:
Timestamp:
Sep 6, 2017 11:09:36 AM (7 years ago)
Author:
vboxsync
Message:

Made it possible to enable include/ syntax checking on the build boxes by defining VBOX_WITH_INCLUDE_SYNTAX_CHECKING in LocalConfig.kmk.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.kmk

    r67129 r68676  
    2828 endif
    2929 include $(PATH_SUB_CURRENT)/src/Makefile.kmk
     30 ifdef VBOX_WITH_INCLUDE_SYNTAX_CHECKING
     31  include $(PATH_SUB_CURRENT)/include/Makefile.kmk
     32 endif
    3033endif
    3134
  • trunk/include/Makefile.kmk

    r68675 r68676  
    1717#
    1818
    19 DEPTH = ..
    20 include $(KBUILD_PATH)/header.kmk
    21 
    22 LIBRARIES = SyntaxVBoxIncludeR3 SyntaxVBoxIncludeR0 SyntaxVBoxIncludeRC
     19SUB_DEPTH = ..
     20include $(KBUILD_PATH)/subheader.kmk
     21
     22LIBRARIES += SyntaxVBoxIncludeR3 SyntaxVBoxIncludeR0 SyntaxVBoxIncludeRC
    2323
    2424# Omit headers that are using C++ features and upsets gcc.
    25 cpp_features_hdrs := \
     25VBOX_HDRS_CPP_FEATURES := \
    2626        VBox/vmm/hm.h \
    2727        VBox/vmm/hm_vmx.h \
     
    3535       VBox/dbus.h \
    3636       VBox/VBoxPktDmp.h \
    37        $(wildcard iprt/cpp/*)
     37       iprt/cpp/%
    3838
    3939# Omit headers that are C++ and ring-3.
    40 r3_cpp_hdrs := \
     40VBOX_HDRS_R3_CPP := \
    4141        VBox/dbggui.h \
    4242        VBox/settings.h \
    4343        VBox/com/Guid.h \
    4444        VBox/HostServices/GuestPropertySvc.h \
    45         $(wildcard iprt/*_cpp.h iprt/cpp/*.h VBox/com/*.h )
     45        iprt/cpp/% \
     46        VBox/com/% \
     47        $(subst $(PATH_SUB_CURRENT)/,,$(wildcard $(PATH_SUB_CURRENT)/iprt/*_cpp.h))
    4648
    4749# Ring-3 only headers.
    48 r3_only_hdrs := \
     50VBOX_HDRS_R3_ONLY := \
    4951        VBox/vrdpapi.h \
    5052        VBox/vrdpusb.h \
     
    8082
    8183# Ring-0 only headers.
    82 r0_only_hdrs := \
     84VBOX_HDRS_R0_ONLY := \
    8385        VBox/VBoxGuestLibSharedFolders.h
    8486
    8587# GCC only headers.
    86 gcc_only_hdrs := \
     88VBOX_HDRS_GCC_ONLY := \
    8789        iprt/nocrt/fenv.h \
    8890        iprt/nocrt/math.h
    8991
    9092# Headers to omit all together.
    91 omit_hdrs := \
     93VBOX_HDRS_OMIT := \
    9294        VBox/HostServices/glext.h \
    9395        VBox/HostServices/glxext.h \
    9496        VBox/HostServices/wglext.h \
    9597        VBox/VBoxGL2D.h \
    96         VBox/WinNetConfig.h \
    97         VBox/usblib-solaris.h \
     98        $(if-expr "$(KBUILD_TARGET)" != "solaris", \
     99                VBox/usblib-solaris.h \
     100        ,)\
    98101        VBox/VDEPlug.h \
    99102        VBox/VDEPlugSymDefs.h \
     
    103106                VBox/VBoxNetCfg-win.h \
    104107                VBox/usblib-win.h \
    105         ,$(gcc_only_hdrs)) \
     108        ,$(VBOX_HDRS_GCC_ONLY)) \
    106109        \
    107110        VBox/dbus-calls.h \
     
    110113        iprt/runtime-loader.h \
    111114        iprt/mangling.h \
    112        $(wildcard iprt/asm*watcom*.h) \
     115       $(subst $(PATH_SUB_CURRENT)/,,$(wildcard $(PATH_SUB_CURRENT)/iprt/asm*watcom*.h)) \
    113116       iprt/asn1-generator% \
    114117       iprt/win/% \
     
    119122
    120123# We omit a few headers which have platform specific issues or are templates.
    121 hdrs := $(filter-out $(omit_hdrs), $(wildcard VBox/*.h VBox/*/*.h iprt/*.h iprt/*/*.h))
     124VBOX_HDRS_ALL := $(filter-out $(VBOX_HDRS_OMIT), \
     125        $(subst $(PATH_SUB_CURRENT)/,,$(wildcard \
     126                $(PATH_SUB_CURRENT)/VBox/*.h \
     127                $(PATH_SUB_CURRENT)/VBox/*/*.h \
     128                $(PATH_SUB_CURRENT)/iprt/*.h \
     129                $(PATH_SUB_CURRENT)/iprt/*/*.h \
     130)))
    122131
    123132# ring-3, ring-0 and raw-mode context specific exclusions.
    124 hdrs.r3   := $(filter-out $(r0_only_hdrs), $(hdrs))
    125 hdrs-c.r3 := $(filter-out $(cpp_features_hdrs) $(r3_cpp_hdrs) $(r0_only_hdrs), $(hdrs.r3))
    126 hdrs.r0   := $(filter-out $(r3_cpp_hdrs) $(r3_only_hdrs), $(hdrs))
    127 hdrs-c.r0 := $(filter-out $(cpp_features_hdrs), $(hdrs.r0))
    128 hdrs.rc   := $(filter-out \
     133VBOX_HDRS_ALL_R3   := $(filter-out $(VBOX_HDRS_R0_ONLY), $(VBOX_HDRS_ALL))
     134VBOX_HDRS_ALL_R3_C := $(filter-out $(VBOX_HDRS_CPP_FEATURES) $(VBOX_HDRS_R3_CPP) $(VBOX_HDRS_R0_ONLY), $(VBOX_HDRS_ALL_R3))
     135VBOX_HDRS_ALL_R0   := $(filter-out $(VBOX_HDRS_R3_CPP) $(VBOX_HDRS_R3_ONLY), $(VBOX_HDRS_ALL))
     136VBOX_HDRS_ALL_R0_C := $(filter-out $(VBOX_HDRS_CPP_FEATURES), $(VBOX_HDRS_ALL_R0))
     137VBOX_HDRS_ALL_RC   := $(filter-out \
    129138        VBox/VBoxGuestLib.h \
    130139        VBox/vmm/gvm.h \
     
    134143        iprt/alloc.h \
    135144        iprt/vector.h \
    136         $(r3_cpp_hdrs) \
    137         $(r3_only_hdrs) \
    138         $(r0_only_hdrs) \
    139         , $(hdrs))
    140 hdrs-c.rc := $(filter-out $(cpp_features_hdrs), $(hdrs.rc))
    141 #$(error $(subst $(SP),$(NLTAB),$(strip $(sort $(hdrs-c.rc)))))
     145        $(VBOX_HDRS_R3_CPP) \
     146        $(VBOX_HDRS_R3_ONLY) \
     147        $(VBOX_HDRS_R0_ONLY) \
     148        , $(VBOX_HDRS_ALL))
     149VBOX_HDRS_ALL_RC_C := $(filter-out $(VBOX_HDRS_CPP_FEATURES), $(VBOX_HDRS_ALL_RC))
     150#$(error $(subst $(SP),$(NLTAB),$(strip $(sort $(VBOX_HDRS_ALL_RC_C)))))
    142151
    143152SyntaxVBoxIncludeR3_TEMPLATE = VBOXMAINEXE
     
    145154SyntaxVBoxIncludeR3_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
    146155SyntaxVBoxIncludeR3_SOURCES := \
    147         $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c,     $(subst /,_,$(hdrs-c.r3)))) \
    148         $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r3))))
     156        $(addprefix $(PATH_OBJ)/include/,$(subst .h,-c.c,     $(subst /,_,$(VBOX_HDRS_ALL_R3_C)))) \
     157        $(addprefix $(PATH_OBJ)/include/,$(subst .h,-cpp.cpp, $(subst /,_,$(VBOX_HDRS_ALL_R3))))
     158SyntaxVBoxIncludeR3_CLEAN = $(SyntaxVBoxIncludeR3_SOURCES)
    149159
    150160SyntaxVBoxIncludeR0_TEMPLATE = VBoxR0
     
    152162SyntaxVBoxIncludeR0_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
    153163SyntaxVBoxIncludeR0_SOURCES := \
    154         $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c,     $(subst /,_,$(hdrs-c.r0)))) \
    155         $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.r0))))
     164        $(addprefix $(PATH_OBJ)/include/,$(subst .h,-c.c,     $(subst /,_,$(VBOX_HDRS_ALL_R0_C)))) \
     165        $(addprefix $(PATH_OBJ)/include/,$(subst .h,-cpp.cpp, $(subst /,_,$(VBOX_HDRS_ALL_R0))))
     166SyntaxVBoxIncludeR0_CLEAN = $(SyntaxVBoxIncludeR0_SOURCES)
    156167
    157168SyntaxVBoxIncludeRC_TEMPLATE = VBoxRc
     
    159170SyntaxVBoxIncludeRC_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
    160171SyntaxVBoxIncludeRC_SOURCES := \
    161         $(addprefix $(PATH_TARGET)/,$(subst .h,-c.c,     $(subst /,_,$(hdrs-c.rc)))) \
    162         $(addprefix $(PATH_TARGET)/,$(subst .h,-cpp.cpp, $(subst /,_,$(hdrs.rc))))
    163 
    164 
    165 # Comment out the next line to simplify header correction.
    166 VBOX_ROOT_INCLUDE_MAKEFILE = $(PATH_ROOT)/include/Makefile.kmk
    167 
    168 include $(FILE_KBUILD_FOOTER)
     172        $(addprefix $(PATH_OBJ)/include/,$(subst .h,-c.c,     $(subst /,_,$(VBOX_HDRS_ALL_RC_C)))) \
     173        $(addprefix $(PATH_OBJ)/include/,$(subst .h,-cpp.cpp, $(subst /,_,$(VBOX_HDRS_ALL_RC))))
     174SyntaxVBoxIncludeRC_CLEAN = $(SyntaxVBoxIncludeRC_SOURCES)
     175
    169176
    170177
    171178# Headers that must only be included once.
    172 only_once_hdrs := \
     179VBOX_HDRS_ONLY_ONCE := \
    173180        iprt/bldprog-strtab-template.cpp.h
    174181
     182
     183# Generate the files we compile.
    175184define def_hdr
    176185$(eval flatname := $(subst /,_,$(basename $(hdr))))
    177186$(eval functioname := $(translate $(flatname),-./,___))
    178 $$(PATH_TARGET)/$(flatname)-cpp.cpp: $(VBOX_ROOT_INCLUDE_MAKEFILE) | $$(PATH_TARGET)/
     187$$(PATH_OBJ)/include/$(flatname)-cpp.cpp: | $$(PATH_OBJ)/include/
    179188        $(QUIET)$$(APPEND) -t -n $$@ \
    180189                '#include <$(hdr)>' \
    181                 $(if-expr $(intersects $(hdr),$(only_once_hdrs)),, '#include <$(hdr)>') \
     190                $(if-expr $(intersects $(hdr),$(VBOX_HDRS_ONLY_ONCE)),, '#include <$(hdr)>') \
    182191                'extern int $(functioname)_cpp(void);' \
    183192                'int $(functioname)_cpp(void) { return 0;}'
    184193
    185 $$(PATH_TARGET)/$(flatname)-c.c: $(VBOX_ROOT_INCLUDE_MAKEFILE) | $$(PATH_TARGET)/
     194$$(PATH_OBJ)/include/$(flatname)-c.c: | $$(PATH_OBJ)/include/
    186195        $(QUIET)$$(APPEND) -t -n $$@ \
    187196                '#include <$(hdr)>' \
    188                 $(if-expr $(intersects $(hdr),$(only_once_hdrs)),, '#include <$(hdr)>') \
     197                $(if-expr $(intersects $(hdr),$(VBOX_HDRS_ONLY_ONCE)),, '#include <$(hdr)>') \
    189198                'extern int $(functioname)_c(void);' \
    190199                'int $(functioname)_c(void) { return 0;}'
    191200
    192201$(subst .h,.o,$(notdir $(hdr)))::
    193 if1of ($(hdr), $(r3_cpp_hdrs) $(cpp_features_hdrs))
     202if1of ($(hdr), $(VBOX_HDRS_R3_CPP) $(VBOX_HDRS_CPP_FEATURES))
    194203        $$(MAKE) -f $(MAKEFILE) $(flatname)-cpp.o
    195204else
     
    199208endef
    200209
    201 $(foreach hdr,$(hdrs), $(eval $(def_hdr)))
    202 
     210$(foreach hdr,$(VBOX_HDRS_ALL), $(eval $(def_hdr)))
     211
     212# Where we put the file.
     213BLDDIRS += $(PATH_OBJ)/include/
     214
     215
     216include $(FILE_KBUILD_SUB_FOOTER)
     217
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette