Skip to content

Commit 19ff6fc

Browse files
committed
100-Makefile
1 parent a1a7878 commit 19ff6fc

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

0x1C-makefiles/100-Makefile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
1+
# Usage: make [all/clean/oclean/fclean] -f [file]
12

23

34
CC = gcc
45
SRC = main.c school.c
5-
OBJ = ${SRC:%.c=%.o}
6+
OBJ = $(SRC:.c=.o)
67
NAME = school
7-
CFLAGS = -Wall -Werror _Wextra -pedantic
8+
CFLAGS = -Wall -Werror -Wextra -pedantic
89

10+
# standard rule to say rules below are not filenames
911
.PHONY: all clean oclean fclean re
1012

11-
all: m.h ${OBJ}
12-
${CC} ${OBJ} -o ${NAME}
13+
# makes executable
14+
all: m.h $(OBJ)
15+
$(CC) $(OBJ) -o $(NAME)
1316

17+
# deletes tmp files & executable
1418
clean:
15-
${RM} *~ ${NAME}
19+
$(RM) *~ $(NAME)
1620

17-
fclean:
18-
${RM} *${OBJ}
21+
# deletes object files
22+
oclean:
23+
$(RM) $(OBJ)
1924

25+
# deletes all (tmp files, executable, & obj files)
2026
fclean: clean oclean
2127

22-
re: fclean all
28+
# deletes all & recompiles all source files
29+
re: oclean all

0 commit comments

Comments
 (0)