C/C++ command line flags 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.
 
 

26 lines
539 B

CC:=gcc
CFLAGS:=-O2 -Wall -Werror
LIBNAME:=flagok
LIBNAMESHARED:=$(LIBNAME).so
LIBNAMESTATIC:=$(LIBNAME).a
SRC:=src/flagok.c
BINDIR:=bin
TESTSRC:=testing/test.c
TESTBIN:=test
shared:
mkdir -p $(BINDIR) && \
$(CC) $(SRC) $(CFLAGS) -shared -fPIC -o $(BINDIR)/$(LIBNAMESHARED)
static:
mkdir -p $(BINDIR) && \
$(CC) $(SRC) $(CFLAGS) -c && \
ar rcs $(BINDIR)/$(LIBNAMESTATIC) *.o && \
rm *.o
test: static
$(CC) $(CFLAGS) -static $(TESTSRC) $(BINDIR)/$(LIBNAMESTATIC) -o $(TESTBIN) && \
./test
clean:
rm -rf $(BINDIR) $(TESTBIN) *.o