Minimize makefile to only output object files
This commit is contained in:
parent
d5e21f6b8e
commit
85e981f29c
63
Makefile
63
Makefile
|
@ -1,65 +1,18 @@
|
||||||
include config.mk
|
include config.mk
|
||||||
include sources.mk
|
|
||||||
|
|
||||||
ifeq (${CC},clang)
|
|
||||||
|
|
||||||
CFLAGS =\
|
|
||||||
-std=c99\
|
|
||||||
-Weverything\
|
|
||||||
-Wno-padded\
|
|
||||||
-Wno-disabled-macro-expansion\
|
|
||||||
-pedantic
|
|
||||||
|
|
||||||
ifeq (${DEBUG},1)
|
|
||||||
CFLAGS += -g
|
|
||||||
else
|
|
||||||
CFLAGS += -O2 -Werror
|
|
||||||
endif
|
|
||||||
|
|
||||||
else ifeq (${CC},gcc)
|
|
||||||
|
|
||||||
CFLAGS =\
|
|
||||||
-std=c99\
|
|
||||||
-Wall\
|
|
||||||
-Wextra\
|
|
||||||
-Wformat-overflow=2\
|
|
||||||
-Wformat-security\
|
|
||||||
-Winit-self\
|
|
||||||
-Wstrict-overflow=2\
|
|
||||||
-Wstringop-overflow=2\
|
|
||||||
-Walloc-zero\
|
|
||||||
-Wduplicated-branches\
|
|
||||||
-Wduplicated-cond\
|
|
||||||
-Wtrampolines\
|
|
||||||
-Wfloat-equal\
|
|
||||||
-Wshadow\
|
|
||||||
-Wunsafe-loop-optimizations\
|
|
||||||
-Wparentheses\
|
|
||||||
-pedantic
|
|
||||||
|
|
||||||
ifeq (${DEBUG},1)
|
|
||||||
CFLAGS += -g
|
|
||||||
else
|
|
||||||
CFLAGS += -O2 -Werror
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
CFLAGS += ${EXTRA_CFLAGS}
|
|
||||||
|
|
||||||
OBJ = ${SRC:.c=.o}
|
OBJ = ${SRC:.c=.o}
|
||||||
|
|
||||||
all: ${OBJ}
|
all: ${OBJ} ${BIN}
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
${CC} -c ${CFLAGS} -o $@ $<
|
${CC} -o $@ -c ${CFLAGS} $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f ${OBJ}
|
rm -f ${OBJ} ${BIN}
|
||||||
|
|
||||||
install: all
|
ifneq (${BIN},)
|
||||||
mkdir -p "${DESTDIR}${PREFIX}/lib/corelibs"
|
${BIN}: ${OBJ}
|
||||||
cp -f ${OBJ} "${DESTDIR}${PREFIX}/lib/corelibs"
|
${CC} -o "$@" ${LDFLAGS} $?
|
||||||
mkdir -p "${DESTDIR}${PREFIX}/include/corelibs"
|
endif
|
||||||
cp -f ${HDR} "${DESTDIR}${PREFIX}/include/corelibs"
|
|
||||||
|
|
||||||
.PHONY: all clean install
|
.PHONY: all clean
|
||||||
|
|
18
config.mk
18
config.mk
|
@ -1,3 +1,21 @@
|
||||||
|
SRC = src/dynarray.c
|
||||||
|
BIN =
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
CC = clang
|
CC = clang
|
||||||
DEBUG = 1
|
DEBUG = 1
|
||||||
|
|
||||||
|
LDFLAGS =\
|
||||||
|
-static
|
||||||
|
|
||||||
|
CFLAGS =\
|
||||||
|
-std=c99\
|
||||||
|
-Weverything\
|
||||||
|
-Wno-padded\
|
||||||
|
-Wno-disabled-macro-expansion\
|
||||||
|
-pedantic
|
||||||
|
ifeq (${DEBUG},1)
|
||||||
|
CFLAGS += -g
|
||||||
|
else
|
||||||
|
CFLAGS += -O2 -Werror
|
||||||
|
endif
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
SRC = dynarray.c
|
|
||||||
HDR = dynarray.h
|
|
Reference in New Issue