2016-06-24 13:32:51 +00:00
|
|
|
OS := $(shell uname)
|
2017-05-29 15:55:14 +00:00
|
|
|
LIBSOURCES = $(wildcard c/common/*.c) $(wildcard c/dec/*.c) \
|
|
|
|
$(wildcard c/enc/*.c)
|
|
|
|
SOURCES = $(LIBSOURCES) c/tools/brotli.c
|
2016-06-24 13:32:51 +00:00
|
|
|
BINDIR = bin
|
|
|
|
OBJDIR = $(BINDIR)/obj
|
2016-07-06 17:09:04 +00:00
|
|
|
LIBOBJECTS = $(addprefix $(OBJDIR)/, $(LIBSOURCES:.c=.o))
|
2016-06-24 13:32:51 +00:00
|
|
|
OBJECTS = $(addprefix $(OBJDIR)/, $(SOURCES:.c=.o))
|
2016-07-06 17:09:04 +00:00
|
|
|
LIB_A = libbrotli.a
|
2017-05-29 15:55:14 +00:00
|
|
|
EXECUTABLE = brotli
|
2017-04-23 12:07:08 +00:00
|
|
|
DIRS = $(OBJDIR)/c/common $(OBJDIR)/c/dec $(OBJDIR)/c/enc \
|
|
|
|
$(OBJDIR)/c/tools $(BINDIR)/tmp
|
2016-06-24 13:32:51 +00:00
|
|
|
CFLAGS += -O2
|
|
|
|
ifeq ($(os), Darwin)
|
|
|
|
CPPFLAGS += -DOS_MACOSX
|
|
|
|
endif
|
2016-06-16 08:52:57 +00:00
|
|
|
|
2016-06-24 13:32:51 +00:00
|
|
|
all: test
|
|
|
|
@:
|
2016-06-16 08:52:57 +00:00
|
|
|
|
2016-06-24 13:32:51 +00:00
|
|
|
.PHONY: all clean test
|
2016-06-16 08:52:57 +00:00
|
|
|
|
2016-06-24 13:32:51 +00:00
|
|
|
$(DIRS):
|
|
|
|
mkdir -p $@
|
2016-06-16 08:52:57 +00:00
|
|
|
|
2016-06-24 13:32:51 +00:00
|
|
|
$(EXECUTABLE): $(OBJECTS)
|
2016-10-31 13:33:59 +00:00
|
|
|
$(CC) $(LDFLAGS) $(OBJECTS) -lm -o $(BINDIR)/$(EXECUTABLE)
|
2016-06-24 13:32:51 +00:00
|
|
|
|
2016-07-06 17:09:04 +00:00
|
|
|
lib: $(LIBOBJECTS)
|
|
|
|
rm -f $(LIB_A)
|
|
|
|
ar -crs $(LIB_A) $(LIBOBJECTS)
|
|
|
|
|
2016-06-24 13:32:51 +00:00
|
|
|
test: $(EXECUTABLE)
|
|
|
|
tests/compatibility_test.sh
|
|
|
|
tests/roundtrip_test.sh
|
|
|
|
|
|
|
|
clean:
|
2016-07-06 17:09:04 +00:00
|
|
|
rm -rf $(BINDIR) $(LIB_A)
|
2016-09-22 09:32:23 +00:00
|
|
|
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
$(OBJECTS): $$(patsubst %.o,%.c,$$(patsubst $$(OBJDIR)/%,%,$$@)) | $(DIRS)
|
2017-04-23 12:07:08 +00:00
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -Ic/include \
|
2016-09-22 09:32:23 +00:00
|
|
|
-c $(patsubst %.o,%.c,$(patsubst $(OBJDIR)/%,%,$@)) -o $@
|