refactor: clean up Makefiles
This commit is contained in:
parent
fb4a9a3b2e
commit
0229db027d
6 changed files with 51 additions and 49 deletions
|
|
@ -1,12 +1,7 @@
|
|||
# https://spin.atomicobject.com/2016/08/26/makefile-c-projects/ was a great
|
||||
# base for this Makefile
|
||||
|
||||
LIB_FILENAME ?= libtrie.a
|
||||
|
||||
BUILD_DIR ?= build
|
||||
SRC_DIR ?= src
|
||||
TEST_DIR ?= test
|
||||
INC_DIRS ?= include
|
||||
-include config.mk
|
||||
|
||||
LIB := $(BUILD_DIR)/$(LIB_FILENAME)
|
||||
|
||||
|
|
@ -23,15 +18,7 @@ BINS_TEST := $(OBJS_TEST:%.c.o=%)
|
|||
TARGETS_TEST := $(BINS_TEST:%=test-%)
|
||||
TARGETS_MEM_TEST := $(BINS_TEST:%=test-mem-%)
|
||||
|
||||
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||
|
||||
# -MMD: generate a .d file for every source file. This file can be imported by
|
||||
# make and makes make aware that a header file has been changed, ensuring an
|
||||
# object file is also recompiled if only a header is changed.
|
||||
# -MP: generate a dummy target for every header file (according to the docs it
|
||||
# prevents some errors when removing header files)
|
||||
CFLAGS ?= -MMD -MP -g
|
||||
_CFLAGS := $(INC_FLAGS) $(CFLAGS) -Wall -Wextra
|
||||
_CFLAGS := $(addprefix -I,$(INC_DIRS)) $(CFLAGS) -Wall -Wextra
|
||||
|
||||
.PHONY: all
|
||||
all: lib
|
||||
|
|
|
|||
13
trie/config.mk
Normal file
13
trie/config.mk
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
LIB_FILENAME = libtrie.a
|
||||
|
||||
BUILD_DIR = build
|
||||
SRC_DIR = src
|
||||
TEST_DIR = test
|
||||
INC_DIRS = include
|
||||
|
||||
# -MMD: generate a .d file for every source file. This file can be imported by
|
||||
# make and makes make aware that a header file has been changed, ensuring an
|
||||
# object file is also recompiled if only a header is changed.
|
||||
# -MP: generate a dummy target for every header file (according to the docs it
|
||||
# prevents some errors when removing header files)
|
||||
CFLAGS = -MMD -MP -g
|
||||
Loading…
Add table
Add a link
Reference in a new issue