A collection of various drop-in helper functions; AKA auxiliary C/С++ library
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.
 
 

32 lines
684 B

CC=gcc
DEFAULTCCFLAGS=-Wall -Werror -O2
SRCDIR=src
LIBNAME=auxilib.a
BUILDDIR=build
BINDIR=bin
TESTDIR=testing
TESTBIN=test
lib:
$(CC) $(DEFAULTCCFLAGS) -c $(SRCDIR)/*/*.c
mkdir -p $(BUILDDIR)
mv *.o $(BUILDDIR)
mkdir -p $(BINDIR)
ar rcs $(BINDIR)/$(LIBNAME) $(BUILDDIR)/*.o
test:
$(CC) $(DEFAULTCCFLAGS) $(TESTDIR)/$(TESTBIN).c $(SRCDIR)/*/*.c -o $(TESTDIR)/$(TESTBIN) && \
cd $(TESTDIR) && \
./$(TESTBIN) && \
rm $(TESTBIN)
test_static: lib
$(CC) $(DEFAULTCCFLAGS) $(TESTDIR)/$(TESTBIN).c $(BINDIR)/$(LIBNAME) -static -o $(TESTDIR)/$(TESTBIN) && \
cd $(TESTDIR) && \
./$(TESTBIN) && \
rm $(TESTBIN)
clean:
rm -rf $(BUILDDIR) $(BINDIR) $(TESTDIR)/$(TESTBIN)