-
-
Save boyvinall/f23420215707fa3e73e21c3f9a5ff22b to your computer and use it in GitHub Desktop.
stackoverflow https://stackoverflow.com/questions/52305098/makefile-fails-implicit-rule-compiles-one-object-file-but-doesnt-compile-the
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef DEFS_H | |
#define DEFS_H | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* DEFS_H */ | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "defs.h" | |
void display_hello() | |
{ | |
printf("Hello!\n"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef HELLO_H | |
#define HELLO_H | |
#ifdef __cplusplus | |
extern "C" { | |
#endif | |
#ifdef __cplusplus | |
} | |
#endif | |
#endif /* HELLO_H */ | |
void display_hello(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "defs.h" | |
#include "hello.h" | |
int main(int argc, char** argv) { | |
display_hello(); | |
return (EXIT_SUCCESS); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
objects = main.o hello.o | |
hello : $(objects) | |
cc -o hello $(objects) | |
hello.o : defs.h | |
main.o : defs.h hello.h | |
.PHONY : clean | |
clean : | |
-rm hello $(objects) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment