components/hwdata/Makefile
changeset 1205 6c6c27bcf9ac
parent 1058 34d7aaa03423
child 1428 94d2b78b3e05
equal deleted inserted replaced
1204:c8e9f85492a3 1205:6c6c27bcf9ac
    16 # fields enclosed by brackets "[]" replaced with your own identifying
    16 # fields enclosed by brackets "[]" replaced with your own identifying
    17 # information: Portions Copyright [yyyy] [name of copyright owner]
    17 # information: Portions Copyright [yyyy] [name of copyright owner]
    18 #
    18 #
    19 # CDDL HEADER END
    19 # CDDL HEADER END
    20 #
    20 #
    21 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    21 # Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
    22 #
    22 #
    23 include ../../make-rules/shared-macros.mk
    23 include ../../make-rules/shared-macros.mk
    24 
    24 
    25 COMPONENT_NAME=         hwdata
    25 COMPONENT_NAME=         hwdata
    26 COMPONENT_VERSION=      0.5.11
    26 COMPONENT_VERSION=      0.5.11
    46 COMPONENT_ARCHIVE_URL_usb.ids =	http://www.linux-usb.org/usb.ids
    46 COMPONENT_ARCHIVE_URL_usb.ids =	http://www.linux-usb.org/usb.ids
    47 COMPONENT_ARCHIVE_URLS = $(foreach i,$(ID_FILES),$(COMPONENT_ARCHIVE_URL_$(i)))
    47 COMPONENT_ARCHIVE_URLS = $(foreach i,$(ID_FILES),$(COMPONENT_ARCHIVE_URL_$(i)))
    48 
    48 
    49 COMPONENT_BUGDB=	utility/hwdata
    49 COMPONENT_BUGDB=	utility/hwdata
    50 
    50 
       
    51 # Retrieve version from ids file
       
    52 ID_VERSION_EXTRACT_COMMAND=$(GSED) -n -e '/Version:/ { s/^.*: //p' -e ' q }'
       
    53 
    51 PKG_OPTIONS += -D COMPONENT_ARCHIVE_URLS='$(COMPONENT_ARCHIVE_URLS:%=value="%")'
    54 PKG_OPTIONS += -D COMPONENT_ARCHIVE_URLS='$(COMPONENT_ARCHIVE_URLS:%=value="%")'
       
    55 PKG_MACROS += $(foreach i,$(ID_FILES),\
       
    56     COMPONENT_VERSION_$(i)='$(shell $(ID_VERSION_EXTRACT_COMMAND) $(i))')
       
    57 
       
    58 # Since we have two separately licensed components we don't use the default
       
    59 # license transform rules, but handle the license info metadata directly
       
    60 LICENSE_TRANSFORMS =
    52 
    61 
    53 $(ID_FILES):
    62 $(ID_FILES):
    54 	curl -s -o $@ $(COMPONENT_ARCHIVE_URL_$(@F))
    63 	curl -s -o $@ $(COMPONENT_ARCHIVE_URL_$(@F))
    55 
    64 
    56 # License files for packaging are generated during the build
    65 # License files for packaging are generated during the build
    57 LICENSES = $(ID_FILES:%=%.license)
    66 LICENSES = $(ID_FILES:%=%.license)
    58 BUILT_LICENSES = $(LICENSES:%=$(BUILD_DIR)/%)
    67 BUILT_LICENSES = $(LICENSES:%=$(BUILD_DIR)/%)
    59 TPNO_pci.ids.license = 7530
       
    60 TPNO_usb.ids.license = 7831
       
    61 
    68 
    62 # Extract the header up to the first blank line
    69 # Extract the header up to the first blank line
    63 $(BUILD_DIR)/%.header: %
    70 $(BUILD_DIR)/%.header: %
    64 	$(MKDIR) $(@D)
    71 	$(MKDIR) $(@D)
    65 	$(GSED) -e '/^$$/ q' $< > $@
    72 	$(GSED) -e '/^$$/ q' $< > $@
    66 
    73 
    67 # Generate license files for each document by substituting in templates:
    74 # Generate license files for each document by substituting in templates:
    68 # __FILE_NAME_VERS__ replace with name & version of ids file
       
    69 # __TPNO__ - Oracle tracking number
       
    70 # __HEADER__ - read in contents of generated header file, then delete the 
    75 # __HEADER__ - read in contents of generated header file, then delete the 
    71 #		__HEADER__ line
    76 #		__HEADER__ line
    72 $(BUILD_DIR)/%.license: $(BUILD_DIR)/%.header
    77 $(BUILD_DIR)/%.license: $(BUILD_DIR)/%.header
    73 	FILENAME="$(basename $(@F))" ; \
    78 	$(GSED) -e '/__HEADER__/ r $<' -e '/__HEADER__/ d' ids.license.tmpl > $@
    74 	VERSION="$$(awk -F: '/Version:/ { print $$2 ; exit }' $<)" ; \
       
    75 	FILE_NAME_VERS="$${FILENAME}$${VERSION}" ; \
       
    76 	$(GSED) -e "s/__FILE_NAME_VERS__/$${FILE_NAME_VERS}/" \
       
    77 	    -e 's/__TPNO__/$(TPNO_$(@F))/' \
       
    78 	    -e '/__HEADER__/ r $<' -e '/__HEADER__/ d' ids.license.tmpl > $@
       
    79 
    79 
    80 install build: $(BUILT_LICENSES)
    80 install build: $(BUILT_LICENSES)
    81 
    81 
    82 test:	$(NO_TESTS)
    82 test:	$(NO_TESTS)
    83 
    83