This repository has been archived on 2022-01-16. You can view files and clone it, but cannot push or open issues or pull requests.
corelibs/template/Makefile

66 lines
969 B
Makefile
Raw Normal View History

2021-08-10 18:28:40 +00:00
include config.mk
2021-08-18 16:11:21 +00:00
include sources.mk
2021-08-10 18:28:40 +00:00
ifeq (${CC},clang)
2021-08-22 20:00:54 +00:00
2021-08-18 16:11:21 +00:00
CFLAGS =\
2021-08-10 18:28:40 +00:00
-std=c99\
-Weverything\
-Wno-padded\
-Wno-disabled-macro-expansion\
2021-08-18 16:11:21 +00:00
-pedantic
2021-08-22 20:00:54 +00:00
ifeq (${DEBUG},1)
CFLAGS += -g
else
CFLAGS += -O2 -Werror
endif
2021-08-10 18:28:40 +00:00
else ifeq (${CC},gcc)
2021-08-22 20:00:54 +00:00
2021-08-18 16:11:21 +00:00
CFLAGS =\
2021-08-10 18:28:40 +00:00
-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\
2021-08-18 16:11:21 +00:00
-pedantic
2021-08-10 18:28:40 +00:00
2021-08-18 16:11:21 +00:00
ifeq (${DEBUG},1)
CFLAGS += -g
else
2021-08-22 20:00:54 +00:00
CFLAGS += -O2 -Werror
endif
2021-08-10 18:28:40 +00:00
endif
2021-08-22 20:00:54 +00:00
CFLAGS += ${EXTRA_CFLAGS}
2021-08-10 18:28:40 +00:00
OBJ = ${SRC:.c=.o}
2021-08-13 15:01:20 +00:00
all: ${OBJ}
2021-08-10 18:28:40 +00:00
%.o: %.c
${CC} -c ${CFLAGS} -o $@ $<
2021-08-10 18:28:40 +00:00
clean:
2021-08-13 15:01:20 +00:00
rm -f ${OBJ}
2021-08-10 18:28:40 +00:00
install: all
mkdir -p "${DESTDIR}${PREFIX}/lib/corelibs"
2021-08-13 15:01:20 +00:00
cp -f ${OBJ} "${DESTDIR}${PREFIX}/lib/corelibs"
2021-08-10 18:28:40 +00:00
mkdir -p "${DESTDIR}${PREFIX}/include/corelibs"
cp -f ${HDR} "${DESTDIR}${PREFIX}/include/corelibs"
.PHONY: all clean install