commit a72e2868b9b9603bb5b83a4c3a938a22ecfc2009 Author: Alex Denes Date: Sun Nov 21 17:06:20 2021 +0000 Initial templates diff --git a/c/Makefile b/c/Makefile new file mode 100644 index 0000000..4596199 --- /dev/null +++ b/c/Makefile @@ -0,0 +1,18 @@ +include config.mk + +OBJ = ${SRC:.c=.o} + +all: ${OBJ} ${BIN} + +%.o: %.c + ${CC} -o $@ -c ${CFLAGS} $< + +clean: + rm -f ${OBJ} ${BIN} + +ifneq (${BIN},) +${BIN}: ${OBJ} + ${CC} -o "$@" ${LDFLAGS} $^ +endif + +.PHONY: all clean diff --git a/c/config.mk b/c/config.mk new file mode 100644 index 0000000..50742d7 --- /dev/null +++ b/c/config.mk @@ -0,0 +1,43 @@ +# Defaults +CXX = clang +DEBUG = 1 +STATIC = 0 + +LDFLAGS = +CXXFLAGS =\ + -std=c99\ + -Weverything\ + -Wno-padded\ + -Wno-disabled-macro-expansion\ + -pedantic + +# Sources / Results +SRC =\ + src/project/main.c + +LIBDIR = +LIB =\ + c + +INCDIR =\ + src/project/ + +BIN = project + +# Conditionals / Appends +LDFLAGS +=\ + $(addprefix -L,${LIBDIR})\ + $(addprefix -l,${LIB}) + +CXXFLAGS +=\ + $(addprefix -I,${INCDIR}) + +ifeq (${DEBUG},1) +CXXFLAGS += -g +else +CXXFLAGS += -O2 -Werror +endif + +ifeq (${STATIC},1) +LDFLAGS += -static +endif diff --git a/cxx/Makefile b/cxx/Makefile new file mode 100644 index 0000000..2d5f5bc --- /dev/null +++ b/cxx/Makefile @@ -0,0 +1,18 @@ +include config.mk + +OBJ = ${SRC:.cpp=.o} + +all: ${OBJ} ${BIN} + +%.o: %.cpp + ${CXX} -o $@ -c ${CXXFLAGS} $< + +clean: + rm -f ${OBJ} ${BIN} + +ifneq (${BIN},) +${BIN}: ${OBJ} + ${CXX} -o "$@" ${LDFLAGS} $^ +endif + +.PHONY: all clean diff --git a/cxx/config.mk b/cxx/config.mk new file mode 100644 index 0000000..0a49684 --- /dev/null +++ b/cxx/config.mk @@ -0,0 +1,42 @@ +# Defaults +CXX = clang++ +DEBUG = 1 +STATIC = 0 + +LDFLAGS = +CXXFLAGS =\ + -Weverything\ + -Wno-padded\ + -Wno-disabled-macro-expansion\ + -pedantic + +# Sources / Results +SRC =\ + src/project/main.cpp + +LIBDIR = +LIB =\ + stdc++ + +INCDIR =\ + src/project/ + +BIN = project + +# Conditionals / Appends +LDFLAGS +=\ + $(addprefix -L,${LIBDIR})\ + $(addprefix -l,${LIB}) + +CXXFLAGS +=\ + $(addprefix -I,${INCDIR}) + +ifeq (${DEBUG},1) +CXXFLAGS += -g +else +CXXFLAGS += -O2 -Werror +endif + +ifeq (${STATIC},1) +LDFLAGS += -static +endif