Minimize makefile to only output object files
This commit is contained in:
parent
9855146f8b
commit
525d0140de
63
Makefile
63
Makefile
@ -1,65 +1,18 @@
|
||||
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}
|
||||
|
||||
all: ${OBJ}
|
||||
all: ${OBJ} ${BIN}
|
||||
|
||||
%.o: %.c
|
||||
${CC} -c ${CFLAGS} -o $@ $<
|
||||
${CC} -o $@ -c ${CFLAGS} $<
|
||||
|
||||
clean:
|
||||
rm -f ${OBJ}
|
||||
rm -f ${OBJ} ${BIN}
|
||||
|
||||
install: all
|
||||
mkdir -p "${DESTDIR}${PREFIX}/lib/corelibs"
|
||||
cp -f ${OBJ} "${DESTDIR}${PREFIX}/lib/corelibs"
|
||||
mkdir -p "${DESTDIR}${PREFIX}/include/corelibs"
|
||||
cp -f ${HDR} "${DESTDIR}${PREFIX}/include/corelibs"
|
||||
ifneq (${BIN},)
|
||||
${BIN}: ${OBJ}
|
||||
${CC} -o "$@" ${LDFLAGS} $?
|
||||
endif
|
||||
|
||||
.PHONY: all clean install
|
||||
.PHONY: all clean
|
||||
|
18
config.mk
18
config.mk
@ -1,3 +1,21 @@
|
||||
SRC = src/llist.c
|
||||
BIN =
|
||||
|
||||
PREFIX = /usr/local
|
||||
CC = clang
|
||||
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 = llist.c
|
||||
HDR = llist.h
|
Reference in New Issue
Block a user