1
0

make clean better

This commit is contained in:
dtb 2022-06-26 16:34:29 -04:00
parent 19282627fc
commit b3bb6acce9

View File

@ -1,27 +1,25 @@
# System utilities # System utilities
CC=cc CC=cc
CFLAGS=-Iinclude/ -Ilib/ -g -Wall CFLAGS=-Iinclude/ -Ilib/ -g -Wall -Wextra -Wpedantic
RM=rm -f RM=rm -f
all: libraries programs all: libraries programs
cleanall: clean cleanlibraries cleanprograms cleanall: clean cleanprograms
clean: clean:
$(RM) src/*.o $(RM) build/*
cleanlibraries:
$(RM) lib/libshell.o
$(RM) lib/libstr.o
cleanprograms: cleanprograms:
$(RM) bin/add $(RM) bin/add
$(RM) bin/calculate
$(RM) bin/cut $(RM) bin/cut
$(RM) bin/echo $(RM) bin/echo
$(RM) bin/eq $(RM) bin/eq
$(RM) bin/false $(RM) bin/false
$(RM) bin/fdivide $(RM) bin/fdivide
$(RM) bin/gt $(RM) bin/gt
$(RM) bin/id
$(RM) bin/lowercase $(RM) bin/lowercase
$(RM) bin/lt $(RM) bin/lt
$(RM) bin/mm $(RM) bin/mm
@ -32,6 +30,10 @@ cleanprograms:
$(RM) bin/streq $(RM) bin/streq
$(RM) bin/str $(RM) bin/str
$(RM) bin/substitute $(RM) bin/substitute
$(RM) bin/sysexits
$(RM) bin/rldecode
$(RM) bin/rlencode
$(RM) bin/roll
$(RM) bin/tail $(RM) bin/tail
libraries: libio libshell stdbool sysexits libraries: libio libshell stdbool sysexits
@ -48,7 +50,8 @@ libstr: lib/libstr.c lib/libstr.h
stdbool: include/stdbool.h stdbool: include/stdbool.h
sysexits_bin: src/sysexits.c sysexits_bin: src/sysexits.c
$(CC) $(CFLAGS) -o bin/sysexits src/sysexits.c $(CC) $(CFLAGS) -c -o build/sysexits.o src/sysexits.c
$(CC) $(CFLAGS) -o bin/sysexits build/sysexits.o
sysexits: sysexits_bin sysexits: sysexits_bin
bin/sysexits >include/sysexits.h bin/sysexits >include/sysexits.h
@ -59,8 +62,11 @@ calculate: libstr sysexits src/calculate.c
$(CC) $(CFLAGS) -o src/calculate.o -c src/calculate.c $(CC) $(CFLAGS) -o src/calculate.o -c src/calculate.c
$(CC) $(CFLAGS) -o bin/calculate lib/libstr.o src/calculate.o $(CC) $(CFLAGS) -o bin/calculate lib/libstr.o src/calculate.o
echo: sysexits src/echo.c echo.o: libio sysexits src/echo.c
$(CC) $(CFLAGS) -o bin/echo src/echo.c $(CC) $(CFLAGS) -c -o build/echo.o src/echo.c
echo: libio echo.o
$(CC) $(CFLAGS) -o bin/echo build/echo.o build/libio.o
false: src/false.c false: src/false.c
$(CC) $(CFLAGS) -o bin/false src/false.c $(CC) $(CFLAGS) -o bin/false src/false.c
@ -124,6 +130,12 @@ substitute: stdbool src/substitute.c
$(CC) $(CFLAGS) -c -o src/substitute.o src/substitute.c $(CC) $(CFLAGS) -c -o src/substitute.o src/substitute.c
$(CC) $(CFLAGS) -o bin/substitute src/substitute.o $(CC) $(CFLAGS) -o bin/substitute src/substitute.o
tail.o: libio src/tail.c
$(CC) $(CFLAGS) -c -o build/tail.o src/tail.c
tail: libio tail.o
$(CC) $(CFLAGS) -o bin/tail build/libio.o build/tail.o
usefulmacros: include/usefulmacros.h usefulmacros: include/usefulmacros.h
which: libshell src/which.c which: libshell src/which.c