79276978

Date: 2024-12-13 00:53:35
Score: 1.5
Natty:
Report link

You have too complicated build of the header. Here is a working example:

# makefile
all: hello

hello: hello.o
    gcc $^ -o $@

hello.o: hello.c hello.h
    gcc -c $< -o $@

hello.h: hello.h.in1 hello.h.in2
    cat $^ > $@
// hello.c
#include "hello.h"

int main() {
    fputs("hello\n", stdout);
    return 0;
}
// hello.h.in1
/* autogenerated header */
// hello.h.in2
#include <stdio.h>

Testing:

$ make
cat hello.h.in1 hello.h.in2 > hello.h
gcc -c hello.c -o hello.o
gcc hello.o -o hello
$ touch hello.h.in2
$ make
cat hello.h.in1 hello.h.in2 > hello.h
gcc -c hello.c -o hello.o
gcc hello.o -o hello
$ touch hello.c
$ make
gcc -c hello.c -o hello.o
gcc hello.o -o hello
$ make
make: Nothing to be done for 'all'.

Questions?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: White Owl