-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (27 loc) · 706 Bytes
/
Makefile
File metadata and controls
38 lines (27 loc) · 706 Bytes
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
CC = g++
CFLAGS = -Wall -Wextra -pedantic -std=c++11
LDFLAGS = -lz
SRCDIR = src
OBJDIR = obj
BINDIR = bin
SRCS = $(wildcard $(SRCDIR)/*.cpp)
OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))
DEPS = $(OBJS:.o=.d)
TARGET = $(BINDIR)/compressor
.PHONY: all clean
all: $(TARGET)
$(TARGET): $(OBJS)
@mkdir -p $(@D)
$(CC) $(LDFLAGS) $^ -o $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
@mkdir -p $(@D)
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
clean:
$(RM) -r $(OBJDIR) $(BINDIR)
-include $(DEPS)
run:
@echo "Usage: compressor [-c|-d] input output. -c 'file to be compressed' filename | -d 'file to be decompressed' filename"
compress:
./$(TARGET) -c input output
decompress:
./$(TARGET) -d input output