This article is work in progress! Check back soon for a full writeup.
main:
rm -rf main
gcc file1.c file2.c -o $@main: file1.c file2.c
gcc file1.c file2.c -o $@file1.o: file1.c
gcc -c file1.c
file2.o: file1.c
gcc -c file2.c
main: file1.o file2.o
gcc file1.o file2.o -o $@OBJS=file1.o file2.o
%.o: %.c
gcc -c $^ -o $@
${info compiled $^!!}
main: $(OBJS)
gcc -fsanitize=address -fno-strict-aliasing -fno-stack-protector -fpie $^ -o $@CC=gcc
CFLAGS=-fsanitize=address -fno-strict-aliasing -fno-stack-protector -fpie
OBJS=file1.o file2.o
main: $(OBJS)
$(CC) $(CFLAGS) $^ -o $@CC=gcc
CFLAGS=-fsanitize=address -fno-strict-aliasing -fno-stack-protector -fpie
OBJS=file1.o file2.o
depend: .depend
gcc -MM *.c > .depend
include .depend
main: $(OBJS) depend
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@%.pdf: %.tex
pdflatex $^
clean:
rm -rf *.log *.aux
.PHONY cleanBasically anytime you want to run command(s) when some
input files are NEWER than some
output files.
${info <stuff>} Useful for
logging
${wildcard *.c} Useful for finding
files
${shell <shell cmd>} Run
arbitrary shell commands!
${foreach i, LIST, <cmd>} :
Do cmd for each i in LIST
Phony Targets: Targets that dont produce the file of their name!
touch *.c(org-babel-result-hide-all)