1#!/usr/bin/env perl 2#*************************************************************************** 3# _ _ ____ _ 4# Project ___| | | | _ \| | 5# / __| | | | |_) | | 6# | (__| |_| | _ <| |___ 7# \___|\___/|_| \_\_____| 8# 9# Copyright (C) Viktor Szakats 10# 11# This software is licensed as described in the file COPYING, which 12# you should have received as part of this distribution. The terms 13# are also available at https://curl.se/docs/copyright.html. 14# 15# You may opt to use, copy, modify, merge, publish, distribute and/or sell 16# copies of the Software, and permit persons to whom the Software is 17# furnished to do so, under the terms of the COPYING file. 18# 19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 20# KIND, either express or implied. 21# 22# SPDX-License-Identifier: curl 23# 24########################################################################### 25 26# Helper script for "unity"-like support in autotools, to generate the umbrella 27# C source that includes the individual source files. Reads Makefile.inc and 28# accepts the variable name containing all the source files to include. Also 29# allow a list of exceptions that are to be excluded from the generated file. 30 31use strict; 32use warnings; 33 34if(!@ARGV) { 35 die "Usage: $0 [<c-sources>] [--exclude <exclude-c-sources>]\n"; 36} 37 38# Specific sources to exclude or add as an extra source file 39my @src; 40my %exclude; 41my $in_exclude = 0; 42foreach my $src (@ARGV) { 43 if($in_exclude) { 44 $exclude{$src} = 1; 45 } 46 elsif($src eq "--exclude") { 47 $in_exclude = 1; 48 } 49 else { 50 push @src, $src; 51 } 52} 53 54print <<HEADER 55/* !checksrc! disable COPYRIGHT all */ 56HEADER 57 ; 58 59foreach my $src (@src) { 60 if($src =~ /\.c$/g && !exists $exclude{$src}) { 61 print "#include \"$src\"\n"; 62 } 63} 64