Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

Commit

Permalink
Gid tier makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Henriquelay committed Mar 4, 2021
1 parent 96ea5ec commit c6bbd94
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
TARGET_EXEC ?= trab1

BUILD_DIR ?= .
SRC_DIRS ?= ./src ./headers

MKDIR_P ?= mkdir -p

SRCS := $(shell find $(SRC_DIRS) -name *.c)
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)

INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS))

CPPFLAGS ?= $(INC_FLAGS) -MMD -MP
CFLAGS ?= $(INC_FLAGS) -g -Wall -Werror -O4

VALGRIND ?= valgrind
VALZIN_FLAGS ?= ""
VAL_FLAGS ?= $(VALZIN_FLAGS) --leak-check-full
VALZAO_FLAGS ?= $(VAL_FLAGS) --show-leak-kinds=all

$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
$(CC) $(OBJS) -o $@ $(LDFLAGS)

# c source
$(BUILD_DIR)/%.c.o: %.c
$(MKDIR_P) $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

clean:
$(RM) $(TARGET_EXEC) */*.o


valzin: $(TARGET_EXEC)
$(VALGRIND) $(VALZIN_FLAGS) $(TARGET_EXEC) $(ARGS)
valzin: $(TARGET_EXEC)
$(VALGRIND) $(VAL_FLAGS) $(TARGET_EXEC) $(ARGS)
valzin: $(TARGET_EXEC)
$(VALGRIND) $(VALZAO_FLAGS) $(TARGET_EXEC) $(ARGS)

0 comments on commit c6bbd94

Please sign in to comment.