You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
737 B
Makefile
55 lines
737 B
Makefile
3 years ago
|
PRJNAME=pcbuffer
|
||
|
PRJOUT=lib$(PRJNAME).a
|
||
|
|
||
|
TESTSOUT=$(PRJNAME)_tests
|
||
|
EXAMPLESOUT=$(PRJNAME)_example
|
||
|
CC=gcc
|
||
|
SIZE=size
|
||
|
MK_DIR=mkdir -p
|
||
|
|
||
|
CFLAGS=\
|
||
|
-Wall \
|
||
|
-DDEBUG \
|
||
|
-std=gnu11 \
|
||
|
-ffunctions-sections \
|
||
|
-O3 \
|
||
|
-g3
|
||
|
|
||
|
|
||
|
ARFLAGS=\
|
||
|
|
||
|
# Core Stuff
|
||
|
CORE_SUB_DIRS=src
|
||
|
CORE_INC_DIRS=\
|
||
|
-I../cfg \
|
||
|
-I../inc
|
||
|
|
||
|
# Tests
|
||
|
TESTS_SUB_DIRS=\
|
||
|
test/src
|
||
|
|
||
|
TESTS_INC_DIRS=\
|
||
|
-I../tests/inc \
|
||
|
-I../test/cfg
|
||
|
|
||
|
# Examples
|
||
|
EXAMPLES_SUB_DIRS=\
|
||
|
EXAMPLES_INC_DIRS=\
|
||
|
|
||
|
.PHONY: all tests examples clean
|
||
|
|
||
|
all: $(CORE_SUB_DIRS) $(PRJOUT)
|
||
|
tests: all $(TESTS_SUB_DIRS) $(TESTSOUT)
|
||
|
examples: all $(EXAMPLES_SUB_DIRS) $(EXAMPLESOUT)
|
||
|
|
||
|
$(PRJOUT): $(CORE_OBJS)
|
||
|
$(AR) $(CORE_INC_DIRS) $(CFLAGS) $(ARFLAGS) $@ $<
|
||
|
|
||
|
$(TESTSOUT): $(TEST_OBJS)
|
||
|
$(CC) $(CFLAGS) -o $< $(TEST_OBJS)
|
||
|
|
||
|
$(EXAMPLESOUT)
|
||
|
|
||
|
|
||
|
|