1#!/bin/bash
2
3# Temporarily (de)ignore Makefiles generated by CMake to allow easier
4# git development
5#
6# Copyright The Mbed TLS Contributors
7# SPDX-License-Identifier: Apache-2.0
8#
9# Licensed under the Apache License, Version 2.0 (the "License"); you may
10# not use this file except in compliance with the License.
11# You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing, software
16# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18# See the License for the specific language governing permissions and
19# limitations under the License.
20
21IGNORE=""
22
23# Parse arguments
24#
25until [ -z "$1" ]
26do
27  case "$1" in
28    -u|--undo)
29      IGNORE="0"
30      ;;
31    -v|--verbose)
32      # Be verbose
33      VERBOSE="1"
34      ;;
35    -h|--help)
36      # print help
37      echo "Usage: $0"
38      echo -e "  -h|--help\t\tPrint this help."
39      echo -e "  -u|--undo\t\tRemove ignores and continue tracking."
40      echo -e "  -v|--verbose\t\tVerbose."
41      exit 1
42      ;;
43    *)
44      # print error
45      echo "Unknown argument: '$1'"
46      exit 1
47      ;;
48  esac
49  shift
50done
51
52if [ "X" = "X$IGNORE" ];
53then
54  [ $VERBOSE ] && echo "Ignoring Makefiles"
55  git update-index --assume-unchanged Makefile library/Makefile programs/Makefile tests/Makefile
56else
57  [ $VERBOSE ] && echo "Tracking Makefiles"
58  git update-index --no-assume-unchanged Makefile library/Makefile programs/Makefile tests/Makefile
59fi
60