You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
531 B
29 lines
531 B
SRC:=src/*.c
|
|
INCLUDE:=include/
|
|
CFLAGS:=-g -Wall -pedantic
|
|
LFLAGS:=
|
|
BUILD:=build
|
|
OBJ:=obj
|
|
|
|
TEST_SRC:=src/test/main.c
|
|
|
|
ifeq ($(shell uname), Linux)
|
|
TARGET_TEST_EXT =
|
|
else
|
|
TARGET_TEST_EXT = .exe
|
|
endif
|
|
|
|
all: clean test
|
|
|
|
clean:
|
|
rm -f $(BUILD)/*
|
|
rm -f $(OBJ)/*
|
|
|
|
liblist:
|
|
gcc -c $(CFLAGS) -I$(INCLUDE) $(SRC)
|
|
mv *.o $(OBJ)/
|
|
ar rcs $(BUILD)/$@.a $(OBJ)/*.o
|
|
|
|
test: liblist
|
|
gcc $(TEST_SRC) $(CFLAGS) -I$(INCLUDE) -o $(BUILD)/$@$(TARGET_TEST_EXT) $(LFLAGS) $(BUILD)/liblist.a
|
|
$(BUILD)/$@$(TARGET_TEST_EXT)
|