Skip to content

Instantly share code, notes, and snippets.

@doi-t
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doi-t/8690106 to your computer and use it in GitHub Desktop.
Save doi-t/8690106 to your computer and use it in GitHub Desktop.
makeでライブラリ(.a)のビルドを管理するサンプル(g++.ver)
#include "hello.h"
int
print_hello(void)
{
printf("hello gnu ar world !!\n");
return 0;
}
#ifndef ___hello
#define ___hello
#include <stdio.h>
int print_hello(void);
#endif //___hello
RM := rm -f
CXXFLAGS := -Wall
programs := run
.PHONY: all
all: $(programs)
$(programs): libhello.a
libhello.a: libhello.a(hello.o)
hello.o: hello.h
.PHONY: clean
clean:
$(RM) *.o *.a $(programs)
#include "hello.h"
int
main(int argc, char **argv)
{
print_hello();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment