diff options
author | JozanLeClerc <JozanLeClerc@noemail.net> | 2020-11-26 19:23:40 +0000 |
---|---|---|
committer | JozanLeClerc <JozanLeClerc@noemail.net> | 2020-11-26 19:23:40 +0000 |
commit | 8a3a88eb3269b3d5fc1701b193cbf5127ba97b77 (patch) | |
tree | 1e0c07677f07f423ab0d3ec4b4fb2377bcc09868 | |
parent | fix (diff) | |
download | bsdsetsid-8a3a88eb3269b3d5fc1701b193cbf5127ba97b77.tar.gz bsdsetsid-8a3a88eb3269b3d5fc1701b193cbf5127ba97b77.tar.bz2 bsdsetsid-8a3a88eb3269b3d5fc1701b193cbf5127ba97b77.tar.xz bsdsetsid-8a3a88eb3269b3d5fc1701b193cbf5127ba97b77.tar.zst bsdsetsid-8a3a88eb3269b3d5fc1701b193cbf5127ba97b77.zip |
Trying to Makefile
FossilOrigin-Name: bc9bbb1101689b7db6e89cca11273e4508143aaf
-rw-r--r-- | Makefile | 32 |
1 files changed, 19 insertions, 13 deletions
@@ -18,51 +18,57 @@ default: all -SRCS_DIR := src/ -OBJS_DIR := obj/ +SRCS_DIR := src +OBJS_DIR := obj PREFIX ?= /usr/local/ DESTDIR := MAKEOBJDIR := ./ SRCS = c_bsdsetsid SRCS := ${SRCS:S/$/.c/g} -SRCS := ${SRCS:S/^/${SRCS_DIR}/g} +SRCS := ${SRCS:S/^/${SRCS_DIR}\//g} OBJS := ${SRCS:=.o} +OBJS := ${SRCS:S/${SRCS_DIR}/${OBJS_DIR}/g} INCS := ${SRCS:.c=.h} NAME := bsdsetsid -CFLAGS = -std=c89 +CC := cc +CFLAGS := -std=c89 CFLAGS += -Wall CFLAGS += -Wextra CFLAGS += -Werror CFLAGS += -pedantic RM := rm -f -RMDIR := rmdir -p MKDIR := mkdir -p +SED := sed -i '' .OBJDIR: ./ .SUFFIXES: .c.o .c -.c.c.o: ${INCS} - ${CC} -c ${CFLAGS} -o ${.TARGET:S/src/obj/} ${.IMPSRC} +.c.c.o: + ${CC} -c ${CFLAGS} -o ${.TARGET} ${.IMPSRC} + +${NAME}: ${OBJS} + ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC} ${OBJS_DIR}: ${MKDIR} ${OBJS_DIR} -${NAME}: ${OBJS} - ${CC} ${CFLAGS} -o ${.TARGET} ${.ALLSRC:S/src/obj/} +.depend: + ${CC} -I${SRCS_DIR} -E -MM ${SRCS} > .depend + ${SED} 's/^/${OBJS_DIR}\//g' .depend + ${SED} 's/\.o/\.c.o/g' .depend -all: ${OBJS_DIR} ${NAME} +all: .depend ${OBJS_DIR} ${NAME} clean: - ${RM} ${OBJS:S/src/obj/} ${NAME} vgcore* + ${RM} ${OBJS} ${NAME} .depend vgcore* ${RM} -R obj -.PHONY: all clean - +.PHONY: all clean .depend # Files prefixes index # -------------------- |