rockbox/firmware/test/buflib/Makefile
Thomas Jarosch e138016256 Initial import of simple buflib unit test
Taken from kugel's out-of-tree version:
https://github.com/kugel-/buflib

Needs some API adaptions. More test will follow.

Note: The expected output needs an update since
the in-tree version of buflib does buffer alignment
and also progressed a bit. Still the tests are a very good start.

Added Rockbox copyright header during import were needed.

Change-Id: Ib39ec4301285f1dd53059b7bed0c0d6646297dc5
2015-01-03 18:15:07 +01:00

50 lines
880 B
Makefile

FIRMWARE=../..
CC ?= gcc
CFLAGS += -g -O2 -DDEBUG -D__PCTOOL__ -std=gnu99 -I$(FIRMWARE)/include -I$(FIRMWARE)/export -I.
LDFLAGS += -L. -lpthread
.PHONY: clean all
TARGETS_OBJ = test_main.o
TARGETS = $(TARGETS_OBJ:.o=)
LIB_OBJ = buflib.o \
crc32.o \
strlcpy.o
LIB_FILE = libbuflib.a
LIB = buflib
ifndef V
SILENT:=@
else
VERBOSEOPT:=-v
endif
PRINTS=$(SILENT)$(call info,$(1))
all: $(TARGETS)
test_%: test_%.o $(LIB_FILE)
$(call PRINTS,LD $@)$(CC) $(LDFLAGS) -o $@ $< -l$(LIB)
$(TARGETS): $(TARGETS_OBJ) $(LIB_FILE)
buflib.o: $(FIRMWARE)/buflib.c
$(CC) $(CFLAGS) -c $< -o $@
crc32.o: $(FIRMWARE)/common/crc32.c
$(CC) $(CFLAGS) -c $< -o $@
strlcpy.o: $(FIRMWARE)/common/strlcpy.c
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.c
$(call PRINTS,CC $<)$(CC) $(CFLAGS) -c $<
$(LIB_FILE): $(LIB_OBJ)
$(call PRINTS,AR $@)ar rcs $@ $^
clean:
rm *.o $(TARGETS) $(LIB_FILE)