make
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| make [2021/03/22 15:25] – utedass | make [2022/09/12 00:30] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 71: | Line 71: | ||
| SOURCES = a.c b.c c.c | SOURCES = a.c b.c c.c | ||
| OBJECTS = $(SOURCES: | OBJECTS = $(SOURCES: | ||
| + | </ | ||
| + | |||
| + | <code make> | ||
| + | # A make file that compiles all c files and places object files | ||
| + | # in the same tree-structure that the sources were found | ||
| + | CC = gcc | ||
| + | CFLAGS = -std=c99 -Wall -Wextra -pedantic -O0 -I. -I utils -I protocol -I command -I driver | ||
| + | OUTFILE = main.exe | ||
| + | |||
| + | OBJDIR | ||
| + | SOURCES := $(shell find * -type f -name " | ||
| + | OBJECTS := $(addprefix $(OBJDIR)/, | ||
| + | |||
| + | run: $(OUTFILE) | ||
| + | @echo ""; | ||
| + | @./ | ||
| + | |||
| + | $(OUTFILE): $(OBJECTS) | ||
| + | $(CC) -o $@ $^ $(CFLAGS) | ||
| + | |||
| + | $(OBJECTS): $(OBJDIR)/ | ||
| + | mkdir -p $(@D) | ||
| + | $(CC) -c -o $@ $^ $(CFLAGS) | ||
| + | |||
| + | .PHONY: clean | ||
| + | clean: | ||
| + | @rm -f $(OUTFILE) *.mk *.o *.pp *.s listing.txt | ||
| + | @rm -rf $(OBJDIR) | ||
| </ | </ | ||
make.1616426704.txt.gz · Last modified: 2022/09/12 00:30 (external edit)
