-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·62 lines (51 loc) · 1.6 KB
/
Makefile
File metadata and controls
executable file
·62 lines (51 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Diretórios
SRC_DIR := src
BIN_DIR := bin
OUT_DIR := output
COMMON_DIR := $(SRC_DIR)/common
COMPRESSOR_DIR := $(SRC_DIR)/compressor
DECOMPRESSOR_DIR := $(SRC_DIR)/descompressor
# Compilador e flags
CC := gcc
CFLAGS := -std=c99 -Wall -Wextra -I$(COMMON_DIR) -I$(COMPRESSOR_DIR) -I$(DECOMPRESSOR_DIR)
# Arquivos-fonte comuns
COMMON_SRC_COMPRESS := \
$(COMMON_DIR)/bloco.c \
$(COMMON_DIR)/consts.c \
$(COMMON_DIR)/header.c \
$(COMMON_DIR)/util.c \
$(COMMON_DIR)/imagem.c \
$(COMMON_DIR)/imagem_comprimir.c
COMMON_SRC_DECOMPRESS := \
$(COMMON_DIR)/bloco.c \
$(COMMON_DIR)/consts.c \
$(COMMON_DIR)/header.c \
$(COMMON_DIR)/util.c \
$(COMMON_DIR)/imagem.c \
$(COMMON_DIR)/imagem_descomprimir.c
# Arquivos do compressor
COMPRESSOR_SRC := $(SRC_DIR)/compressor.c \
$(wildcard $(COMPRESSOR_DIR)/*.c) \
$(COMMON_SRC_COMPRESS)
# Arquivos do descompressor
DECOMPRESSOR_SRC := $(SRC_DIR)/descompressor.c \
$(wildcard $(DECOMPRESSOR_DIR)/*.c) \
$(COMMON_SRC_DECOMPRESS)
# Alvos
all: $(BIN_DIR)/compressor $(BIN_DIR)/descompressor
$(BIN_DIR)/compressor: $(COMPRESSOR_SRC)
@mkdir -p $(BIN_DIR)
$(CC) $(CFLAGS) $^ -o $@
$(BIN_DIR)/descompressor: $(DECOMPRESSOR_SRC)
@mkdir -p $(BIN_DIR)
$(CC) $(CFLAGS) $^ -o $@
# Limpeza agressiva
clean:
rm -rf $(BIN_DIR)
# Ajuda
help:
@echo "Alvos disponíveis:"
@echo " make - Compila compressor e descompressor"
@echo " make clean - Remove binários, arquivos de saída e diretórios"
@echo " make help - Exibe esta ajuda"
.PHONY: all clean help