brotli/Makefile

43 lines
991 B
Makefile
Raw Normal View History

2016-06-24 13:32:51 +00:00
OS := $(shell uname)
LIBSOURCES = $(wildcard common/*.c) $(wildcard dec/*.c) $(wildcard enc/*.c)
SOURCES = $(LIBSOURCES) tools/bro.c
2016-06-24 13:32:51 +00:00
BINDIR = bin
OBJDIR = $(BINDIR)/obj
LIBOBJECTS = $(addprefix $(OBJDIR)/, $(LIBSOURCES:.c=.o))
2016-06-24 13:32:51 +00:00
OBJECTS = $(addprefix $(OBJDIR)/, $(SOURCES:.c=.o))
LIB_A = libbrotli.a
2016-06-24 13:32:51 +00:00
EXECUTABLE = bro
DIRS = $(OBJDIR)/common $(OBJDIR)/dec $(OBJDIR)/enc \
$(OBJDIR)/tools $(BINDIR)/tmp
CFLAGS += -O2
ifeq ($(os), Darwin)
CPPFLAGS += -DOS_MACOSX
endif
2016-06-24 13:32:51 +00:00
all: test
@:
2016-06-24 13:32:51 +00:00
.PHONY: all clean test
2016-06-24 13:32:51 +00:00
$(DIRS):
mkdir -p $@
2016-06-24 13:32:51 +00:00
$(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) -lm -o $(BINDIR)/$(EXECUTABLE)
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:
rm -rf $(BINDIR) $(LIB_A)
.SECONDEXPANSION:
$(OBJECTS): $$(patsubst %.o,%.c,$$(patsubst $$(OBJDIR)/%,%,$$@)) | $(DIRS)
$(CC) $(CFLAGS) $(CPPFLAGS) -Iinclude \
-c $(patsubst %.o,%.c,$(patsubst $(OBJDIR)/%,%,$@)) -o $@