
TARGET_NAME=liblzma.a

SRC_DIR += $(shell pwd)/
INC_DIR += $(shell pwd)/

SRC_DIR += $(shell pwd)/check/
SRC_DIR += $(shell pwd)/common/
SRC_DIR += $(shell pwd)/common_xz/
SRC_DIR += $(shell pwd)/lz/
SRC_DIR += $(shell pwd)/lzma/
SRC_DIR += $(shell pwd)/rangecoder/

INC_DIR += $(shell pwd)/
INC_DIR += $(shell pwd)/api/
INC_DIR += $(shell pwd)/check/
INC_DIR += $(shell pwd)/common/
INC_DIR += $(shell pwd)/common_xz/
INC_DIR += $(shell pwd)/lz/
INC_DIR += $(shell pwd)/lzma/
INC_DIR += $(shell pwd)/rangecoder/

CFLAGS = -DHAVE_CONFIG_H

ifeq ($(CONFIG_FIRMWARE_MINIOS), y)
CFLAGS+=-DCONFIG_FIRMWARE_MINIOS
endif
SRCS += $(foreach d, $(SRC_DIR), $(wildcard $(d)*.c))
OBJS += $(SRCS:%.c=%.o)

LDFLAGS += -lm -lrt
LDFLAGS += -lpthread
CFLAGS += -std=gnu99
CFLAGS += $(foreach d, $(INC_DIR), -I$(d))

$(TARGET_NAME):$(OBJS)
	$(AR) crus -o $@ $(OBJS)

%.o:%.c
	$(CC) $(CFLAGS) -c $^ -o $@

clean:
	@rm -rf $(TARGET_NAME) $(OBJS)
