add big makefile for project with report
This commit is contained in:
parent
308bfe0c6f
commit
edad5ef7cf
1 changed files with 54 additions and 0 deletions
54
c_project_archive_report.mk
Normal file
54
c_project_archive_report.mk
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
CC = gcc
|
||||||
|
RM = rm -rf
|
||||||
|
TAR = tar -cf
|
||||||
|
CP = cp -r
|
||||||
|
MKDIR = mkdir -p
|
||||||
|
|
||||||
|
SRC_DIR = src
|
||||||
|
INC_DIR = includes
|
||||||
|
SOURCES = $(wildcard $(SRC_DIR)/*.c)
|
||||||
|
OBJETS = $(patsubst %.c,%.o,$(notdir $(SOURCES)))
|
||||||
|
|
||||||
|
CFLAGS = -std=gnu11 -pedantic
|
||||||
|
LDFLAGS =
|
||||||
|
|
||||||
|
EXE = project
|
||||||
|
EXE_EXT = .elf
|
||||||
|
|
||||||
|
ARCHIVE = kennel
|
||||||
|
PDF_DIR = report
|
||||||
|
|
||||||
|
%.o: src/%.c
|
||||||
|
$(CC) -c $< -o $@ $(CFLAGS)
|
||||||
|
|
||||||
|
compilation: $(OBJETS)
|
||||||
|
$(CC) -o $(EXE)$(EXE_EXT) $(OBJETS) $(LDFLAGS)
|
||||||
|
|
||||||
|
main: CFLAGS += -O3
|
||||||
|
main: compilation
|
||||||
|
|
||||||
|
debug: CFLAGS += -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes
|
||||||
|
debug: CFLAGS += -fanalyzer -fsanitize=undefined -g -Og
|
||||||
|
debug: LDFLAGS += -fsanitize=undefined
|
||||||
|
debug: compilation
|
||||||
|
|
||||||
|
all:
|
||||||
|
main
|
||||||
|
|
||||||
|
pdf-make:
|
||||||
|
cd report && \
|
||||||
|
$(MAKE)
|
||||||
|
|
||||||
|
pdf-clean:
|
||||||
|
@cd report && \
|
||||||
|
$(MAKE) clean
|
||||||
|
|
||||||
|
clean: pdf-clean
|
||||||
|
$(RM) $(OBJETS) "$(EXE)$(EXE_EXT)" "$(ARCHIVE).tar"
|
||||||
|
|
||||||
|
archive: pdf-make
|
||||||
|
$(MKDIR) "$(ARCHIVE)"
|
||||||
|
$(CP) "$(SRC_DIR)" "$(INC_DIR)" Makefile README \
|
||||||
|
"$(wildcard $(PDF_DIR)/*.pdf)" "$(ARCHIVE)"
|
||||||
|
$(TAR) "$(ARCHIVE).tar" "$(ARCHIVE)"
|
||||||
|
$(RM) "$(ARCHIVE)"
|
Loading…
Reference in a new issue