components/hwdata/Makefile
changeset 302 0b738df97c00
child 304 cfebb7b36966
equal deleted inserted replaced
301:ab9eef4f4029 302:0b738df97c00
       
     1 #
       
     2 # CDDL HEADER START
       
     3 #
       
     4 # The contents of this file are subject to the terms of the
       
     5 # Common Development and Distribution License (the "License").
       
     6 # You may not use this file except in compliance with the License.
       
     7 #
       
     8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
     9 # or http://www.opensolaris.org/os/licensing.
       
    10 # See the License for the specific language governing permissions
       
    11 # and limitations under the License.
       
    12 #
       
    13 # When distributing Covered Code, include this CDDL HEADER in each
       
    14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    15 # If applicable, add the following below this CDDL HEADER, with the
       
    16 # fields enclosed by brackets "[]" replaced with your own identifying
       
    17 # information: Portions Copyright [yyyy] [name of copyright owner]
       
    18 #
       
    19 # CDDL HEADER END
       
    20 #
       
    21 # Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
       
    22 #
       
    23 include ../../make-rules/shared-macros.mk
       
    24 
       
    25 COMPONENT_NAME=         hwdata
       
    26 COMPONENT_VERSION=      0.5.11
       
    27 
       
    28 include ../../make-rules/ips.mk
       
    29 
       
    30 # Since upstream only offers the latest snapshot for download, without
       
    31 # any way to retrieve a specific version, we just keep the currently
       
    32 # shipped versions of these two text files directly in the gate and 
       
    33 # simply check in new versions to update them.
       
    34 #
       
    35 # When it's time to update, you can use these rules to download with
       
    36 # 'gmake -B pci.ids usb.ids'   After updating the data files, ensure
       
    37 # that the header with version/date and license info is still being 
       
    38 # correctly extracted and copied into the generated license files.
       
    39 
       
    40 ID_FILES = pci.ids usb.ids
       
    41 
       
    42 COMPONENT_ARCHIVE_URL_pci.ids =	http://pciids.sourceforge.net/v2.2/pci.ids
       
    43 COMPONENT_ARCHIVE_URL_usb.ids =	http://www.linux-usb.org/usb.ids
       
    44 COMPONENT_ARCHIVE_URLS = $(foreach i,$(ID_FILES),$(COMPONENT_ARCHIVE_URL_$(i)))
       
    45 
       
    46 PKG_OPTIONS += -D COMPONENT_ARCHIVE_URLS='$(COMPONENT_ARCHIVE_URLS:%=value="%")'
       
    47 
       
    48 $(ID_FILES):
       
    49 	curl -s -o $@ $(COMPONENT_ARCHIVE_URL_$(@F))
       
    50 
       
    51 # License files for packaging are generated during the build
       
    52 LICENSES = $(ID_FILES:%=%.license)
       
    53 BUILT_LICENSES = $(LICENSES:%=$(BUILD_DIR)/%)
       
    54 
       
    55 # Extract the header up to the first blank line
       
    56 $(BUILD_DIR)/%.header: % $(BUILD_DIR)
       
    57 	$(GSED) -e '/^$$/ q' $< > $@
       
    58 
       
    59 # Generate license files for each document by substituting in templates:
       
    60 # __FILENAME__ replace with name of ids file (uses basename to strip
       
    61 #		.license suffix, @F to strip the directories from file path)
       
    62 # __HEADER__ - read in contents of generated header file, then delete the 
       
    63 #		__HEADER__ line
       
    64 $(BUILD_DIR)/%.license: $(BUILD_DIR)/%.header
       
    65 	$(GSED) -e 's/__FILENAME__/$(basename $(@F))/' \
       
    66 	    -e '/__HEADER__/ r $<' -e '/__HEADER__/ d' ids.license.tmpl > $@
       
    67 
       
    68 $(BUILD_DIR):
       
    69 	$(MKDIR) $@
       
    70 
       
    71 build:	$(BUILD_DIR) $(BUILT_LICENSES)
       
    72 
       
    73 test:	$(NO_TESTS)
       
    74 
       
    75 clean::
       
    76 	$(RM) -r $(BUILD_DIR)
       
    77 
       
    78 include ../../make-rules/depend.mk