Initial templates
This commit is contained in:
commit
a72e2868b9
18
c/Makefile
Normal file
18
c/Makefile
Normal file
@ -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
|
43
c/config.mk
Normal file
43
c/config.mk
Normal file
@ -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
|
18
cxx/Makefile
Normal file
18
cxx/Makefile
Normal file
@ -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
|
42
cxx/config.mk
Normal file
42
cxx/config.mk
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user