Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/scripts/mk-unity.pl
2065 views
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
31
use strict;
32
use warnings;
33
34
if(!@ARGV) {
35
die "Usage: $0 [<c-sources>] [--exclude <exclude-c-sources>]\n";
36
}
37
38
my $srcdir = shift @ARGV;
39
40
# Specific sources to exclude or add as an extra source file
41
my @src;
42
my %exclude;
43
my $in_exclude = 0;
44
foreach my $src (@ARGV) {
45
if($in_exclude) {
46
$exclude{$src} = 1;
47
}
48
elsif($src eq "--exclude") {
49
$in_exclude = 1;
50
}
51
else {
52
push @src, $src;
53
}
54
}
55
56
print <<HEADER
57
/* !checksrc! disable COPYRIGHT all */
58
HEADER
59
;
60
61
foreach my $src (@src) {
62
if($src =~ /\.c$/g && !exists $exclude{$src}) {
63
if(-e "$srcdir/$src") {
64
print "#include \"$srcdir/$src\"\n";
65
}
66
else {
67
print "#include \"$src\"\n";
68
}
69
}
70
}
71
72