Added Makefile

This commit is contained in:
Anthony Wang 2020-05-25 01:46:09 +00:00 committed by repl.it user
parent 22c5301461
commit 02702e30f3
6 changed files with 31 additions and 1 deletions

View file

@ -1,2 +1,2 @@
language = "cpp"
run = "g++ src/*.cpp -o out -std=c++11; ./out; rm out"
run = "make; ./compress; rm compress"

20
Makefile Normal file
View file

@ -0,0 +1,20 @@
TARGET ?= compress
SRC_DIRS ?= ./src
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
OBJS := $(addsuffix .o,$(basename $(SRCS)))
DEPS := $(OBJS:.o=.d)
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
CPPFLAGS ?= $(INC_FLAGS) -MMD -MP -std=c++11
$(TARGET): $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) -o $@ $(LOADLIBES) $(LDLIBS)
.PHONY: clean
clean:
$(RM) $(TARGET) $(OBJS) $(DEPS)
-include $(DEPS)

5
src/huffman.d Normal file
View file

@ -0,0 +1,5 @@
src/huffman.o: src/huffman.cpp src/huffman.h src/common.h
src/huffman.h:
src/common.h:

BIN
src/huffman.o Normal file

Binary file not shown.

5
src/main.d Normal file
View file

@ -0,0 +1,5 @@
src/main.o: src/main.cpp src/common.h src/huffman.h
src/common.h:
src/huffman.h:

BIN
src/main.o Normal file

Binary file not shown.