VirtualBox

Changeset 68689 in vbox for trunk/include


Ignore:
Timestamp:
Sep 7, 2017 8:32:22 AM (7 years ago)
Author:
vboxsync
Message:

include/Makefile.kmk: Simplify.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/Makefile.kmk

    r68676 r68689  
    154154SyntaxVBoxIncludeR3_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
    155155SyntaxVBoxIncludeR3_SOURCES := \
    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))))
     156        $(addprefix $(PATH_OBJ)/include/c/,  $(addsuffix .c,  $(basename $(VBOX_HDRS_ALL_R3_C)))) \
     157        $(addprefix $(PATH_OBJ)/include/cpp/,$(addsuffix .cpp,$(basename $(VBOX_HDRS_ALL_R3))))
    158158SyntaxVBoxIncludeR3_CLEAN = $(SyntaxVBoxIncludeR3_SOURCES)
     159#$(error $(subst $(SP),$(NLTAB),$(strip $(sort $(SyntaxVBoxIncludeR3_SOURCES)))))
    159160
    160161SyntaxVBoxIncludeR0_TEMPLATE = VBoxR0
     
    162163SyntaxVBoxIncludeR0_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
    163164SyntaxVBoxIncludeR0_SOURCES := \
    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))))
     165        $(addprefix $(PATH_OBJ)/include/c/,  $(addsuffix .c,  $(basename $(VBOX_HDRS_ALL_R0_C)))) \
     166        $(addprefix $(PATH_OBJ)/include/cpp/,$(addsuffix .cpp,$(basename $(VBOX_HDRS_ALL_R0))))
    166167SyntaxVBoxIncludeR0_CLEAN = $(SyntaxVBoxIncludeR0_SOURCES)
    167168
     
    170171SyntaxVBoxIncludeRC_CDEFS = VBOX_WITHOUT_UNNAMED_UNIONS
    171172SyntaxVBoxIncludeRC_SOURCES := \
    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))))
     173        $(addprefix $(PATH_OBJ)/include/c/,  $(addsuffix .c,  $(basename $(VBOX_HDRS_ALL_RC_C)))) \
     174        $(addprefix $(PATH_OBJ)/include/cpp/,$(addsuffix .cpp,$(basename $(VBOX_HDRS_ALL_RC))))
    174175SyntaxVBoxIncludeRC_CLEAN = $(SyntaxVBoxIncludeRC_SOURCES)
    175176
     
    183184# Generate the files we compile.
    184185define def_hdr
    185 $(eval flatname := $(subst /,_,$(basename $(hdr))))
    186 $(eval functioname := $(translate $(flatname),-./,___))
    187 $$(PATH_OBJ)/include/$(flatname)-cpp.cpp: | $$(PATH_OBJ)/include/
     186 $(eval functioname := $(translate $(basename $(hdr)),-./,___))
     187
     188 $$(PATH_OBJ)/include/c/$(basename $(hdr)).c: | $$$$(dir $$$$@)
     189        $(QUIET)$$(APPEND) -t -n $$@ \
     190                '#include <$(hdr)>' \
     191                $(if-expr $(intersects $(hdr),$(VBOX_HDRS_ONLY_ONCE)),, '#include <$(hdr)>') \
     192                'extern int $(functioname)_c(void);' \
     193                'int $(functioname)_c(void) { return 0;}'
     194
     195 $$(PATH_OBJ)/include/cpp/$(basename $(hdr)).cpp: | $$$$(dir $$$$@)
    188196        $(QUIET)$$(APPEND) -t -n $$@ \
    189197                '#include <$(hdr)>' \
     
    192200                'int $(functioname)_cpp(void) { return 0;}'
    193201
    194 $$(PATH_OBJ)/include/$(flatname)-c.c: | $$(PATH_OBJ)/include/
    195         $(QUIET)$$(APPEND) -t -n $$@ \
    196                 '#include <$(hdr)>' \
    197                 $(if-expr $(intersects $(hdr),$(VBOX_HDRS_ONLY_ONCE)),, '#include <$(hdr)>') \
    198                 'extern int $(functioname)_c(void);' \
    199                 'int $(functioname)_c(void) { return 0;}'
    200 
    201 $(subst .h,.o,$(notdir $(hdr)))::
    202 if1of ($(hdr), $(VBOX_HDRS_R3_CPP) $(VBOX_HDRS_CPP_FEATURES))
    203         $$(MAKE) -f $(MAKEFILE) $(flatname)-cpp.o
    204 else
    205         $$(MAKE) -f $(MAKEFILE) $(flatname)-c.o $(flatname)-cpp.o
    206 endif
    207 
    208202endef
    209203
    210204$(foreach hdr,$(VBOX_HDRS_ALL), $(eval $(def_hdr)))
    211205
    212 # Where we put the file.
    213 BLDDIRS += $(PATH_OBJ)/include/
     206# Tell kBuild to generate rules for making the directories for the generated files.
     207VBOX_HDR_DIRS := $(sort $(dir $(VBOX_HDRS_ALL)))
     208BLDDIRS += $(addprefix $(PATH_OBJ)/include/c/,$(VBOX_HDR_DIRS)) $(addprefix $(PATH_OBJ)/include/cpp/,$(VBOX_HDR_DIRS))
    214209
    215210
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