Last active
October 20, 2021 21:18
-
-
Save laughingclouds/45624204d8b4a6517e613f9e545ca9f9 to your computer and use it in GitHub Desktop.
Recursively remove all the files that don't have the specified extension.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -type f ! -name "*.c" ! -name "*.h" ! -name "*.json" ! -name "*.py" ! -name "*.sh" ! -name "*.md" -exec rm {} \; | |
# This (recursively) removes any files that don't end with the above extensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# code to compile one whole project (directory) | |
# Won't work if | |
# you have multiple folders | |
# you execute this from outside the project directory | |
COMPILER_INPUT="$(find ./$1 -type f -name "*.c")"; | |
gcc $COMPILER_INPUT -o "./$1/a.out"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Better than the rest, a frickin' makefile! | |
# https://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/ | |
CC=gcc | |
CFLAGS=-I. | |
DEPS = header_file.h | |
OBJ = file1.c file2.c and_so_on.c | |
%.o: %.c $(DEPS) # for compiling the object code | |
$(CC) -c -o $@ $< $(CFLAGS) | |
main: $(OBJ) # for the final main file | |
$(CC) -o $@ $^ $(CFLAGS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment