From 78169356c43054bd2493ab6bf1bb24a254d8ebb7 Mon Sep 17 00:00:00 2001 From: yinjiaji Date: Wed, 29 Jul 2026 17:52:59 +0800 Subject: [PATCH] Makefile: do not compile headers as source files Passing ttyclock.h to the compiler makes clang treat it as a separate translation unit, which fails when a single output is requested: clang: error: cannot specify -o when generating multiple output files Keep the header as a rebuild dependency while compiling only ttyclock.c. --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9428506..a485bd8 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,8 @@ #Under BSD License #See clock.c for the license detail. -SRC = ttyclock.c ttyclock.h +SRC = ttyclock.c +HEADERS = ttyclock.h CC ?= gcc BIN ?= tty-clock PREFIX ?= /usr/local @@ -26,7 +27,7 @@ else LDFLAGS += $$(pkg-config --libs ncurses) endif -tty-clock : ${SRC} +tty-clock : ${SRC} ${HEADERS} @echo "building ${SRC}" ${CC} ${CFLAGS} ${SRC} -o ${BIN} ${LDFLAGS}