diff options
author | 2023-05-27 12:48:06 +0200 | |
---|---|---|
committer | 2023-05-27 12:48:06 +0200 | |
commit | 4e2a713e194c6dfc51c388a92f06b311e3d979c9 (patch) | |
tree | 8859651c759d9f79fcd5626ec407a5645c196e62 | |
parent | 8841e2894b0160277a104f0da7838adbce5f6542 (diff) | |
download | cherry-4e2a713e194c6dfc51c388a92f06b311e3d979c9.tar.gz cherry-4e2a713e194c6dfc51c388a92f06b311e3d979c9.zip |
Change the Makefile
This is a new Makefile genrated by scripts/buildmk.sh. So, you can touch
only config.mk that isn't auto-generated.
-rw-r--r-- | Makefile | 63 |
1 files changed, 55 insertions, 8 deletions
@@ -2,17 +2,64 @@ include config.mk -all: ${NAME} +BUILD_DIR = build +DIST_DIR = dist +OBJ = ${BUILD_DIR}/cherry.o ${BUILD_DIR}/main.o ${BUILD_DIR}/window.o ${BUILD_DIR}/application.o ${BUILD_DIR}/event.o ${BUILD_DIR}/widget.o +INCLUDES != find src -name '*.h' -${NAME}: ${OBJ} - ${CC} ${LFLAGS} ${OBJ} -o $@ +all: static shared -debug: - @make OPT=-g all +${DIST_DIR}: all + mkdir -p $@/include/cherry + cp ${BUILD_DIR}/release/static/${LIBNAME:=.a} $@/ + cp ${BUILD_DIR}/release/shared/${LIBNAME:=.so} $@/ + cp ${INCLUDES} $@/include/cherry -.c.o: - ${CC} ${CFLAGS} -c $< -o $@ +debug: debug-static debug-shared + +static: + @make BUILD_DIR=${BUILD_DIR}/release/static ${BUILD_DIR}/release/static/${LIBNAME:=.a} + +shared: + @make BUILD_DIR=${BUILD_DIR}/release/shared OPT="${OPT} -fPIC" ${BUILD_DIR}/release/shared/${LIBNAME:=.so} + +debug-static: + @make BUILD_DIR=${BUILD_DIR}/debug/static OPT=-g ${BUILD_DIR}/debug/static/${LIBNAME:=.a} + +debug-shared: + @make BUILD_DIR=${BUILD_DIR}/debug/shared OPT="-g -fPIC" ${BUILD_DIR}/debug/shared/${LIBNAME:=.so} + +${BUILD_DIR}: + @mkdir -p $@ + +${BUILD_DIR}/${LIBNAME:=.so}: ${BUILD_DIR} ${OBJ} + ${CC} ${LFLAGS} -shared ${OBJ} -o $@ + +${BUILD_DIR}/${LIBNAME:=.a}: ${BUILD_DIR} ${OBJ} + ar rcs $@ ${OBJ} + +clean-obj: + rm -rf ${BUILD_DIR}/cherry.o ${BUILD_DIR}/main.o ${BUILD_DIR}/window.o ${BUILD_DIR}/application.o ${BUILD_DIR}/event.o ${BUILD_DIR}/widget.o clean: - rm -rf ${OBJ} ${NAME} + rm -rf ${BUILD_DIR} rm -f *.core + +${BUILD_DIR}/cherry.o: src/cherry.c + ${CC} ${CFLAGS} -c $> -o $@ + +${BUILD_DIR}/main.o: src/main.c + ${CC} ${CFLAGS} -c $> -o $@ + +${BUILD_DIR}/window.o: src/window.c + ${CC} ${CFLAGS} -c $> -o $@ + +${BUILD_DIR}/application.o: src/application.c + ${CC} ${CFLAGS} -c $> -o $@ + +${BUILD_DIR}/event.o: src/event.c + ${CC} ${CFLAGS} -c $> -o $@ + +${BUILD_DIR}/widget.o: src/widget.c + ${CC} ${CFLAGS} -c $> -o $@ + |