From 1a3014f948b5a2c7ca93c6b052e356e55e1907ae Mon Sep 17 00:00:00 2001 From: nishi Date: Wed, 17 Jan 2024 00:46:42 +0000 Subject: [PATCH] well git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@2 d27a3e52-49c5-7645-884c-6793ebffc270 --- Example/Makefile | 7 +++++++ Example/fetch.c | 14 ++++++++++++++ Library/Core.c | 2 ++ Library/Makefile | 11 +++++++++++ Library/W3Core.h | 5 +++++ Makefile | 14 +++++++++++--- 6 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 Example/Makefile create mode 100644 Example/fetch.c create mode 100644 Library/Core.c create mode 100644 Library/Makefile create mode 100644 Library/W3Core.h diff --git a/Example/Makefile b/Example/Makefile new file mode 100644 index 0000000..0b15da1 --- /dev/null +++ b/Example/Makefile @@ -0,0 +1,7 @@ +.PHONY: clean + +./fetch: ./fetch.c + $(CC) -o $@ $< ../Library/libw3.so + +clean: + rm -f fetch *.o *.so *.core diff --git a/Example/fetch.c b/Example/fetch.c new file mode 100644 index 0000000..bf4f8f7 --- /dev/null +++ b/Example/fetch.c @@ -0,0 +1,14 @@ +/* $Id$ + * + * Fetch a file using libw3. + * + */ + +#include + +int main(int argc, char** argv){ + if(argc < 2){ + fprintf(stderr, "Usage: %s URL\n", argv[0]); + return 1; + } +} diff --git a/Library/Core.c b/Library/Core.c new file mode 100644 index 0000000..99b5b5a --- /dev/null +++ b/Library/Core.c @@ -0,0 +1,2 @@ +/* $Id$ */ +#include "W3Core.h" diff --git a/Library/Makefile b/Library/Makefile new file mode 100644 index 0000000..468ebaa --- /dev/null +++ b/Library/Makefile @@ -0,0 +1,11 @@ +# $Id$ +.PHONY: clean + +./libw3.so: ./Core.o + $(CC) $(LDFLAGS) -shared -o $@ $^ + +./%.o: ./%.c W3%.h + $(CC) $(CFLAGS) -c -o $@ $< + +clean: + rm -f *.o *.so *.core diff --git a/Library/W3Core.h b/Library/W3Core.h new file mode 100644 index 0000000..ff003c8 --- /dev/null +++ b/Library/W3Core.h @@ -0,0 +1,5 @@ +/* $Id$ */ +#ifndef __W3CORE_H__ +#define __W3CORE_H__ + +#endif diff --git a/Makefile b/Makefile index aa8871f..37ff8bb 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,19 @@ LIBS := ifdef SSL LIBS += -lssl -lcrypto +SSL=SSL=YES endif -.PHONY: all +.PHONY: all clean -all: ./Library/libw3.so +all: ./Library/libw3.so ./Example/fetch ./Library/libw3.so: - $(MAKE) -C ./Library + $(MAKE) -C ./Library $(SSL) CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" + +./Example/fetch: + $(MAKE) -C ./Example CC=$(CC) fetch + +clean: + $(MAKE) -C ./Library clean + $(MAKE) -C ./Example clean -- 2.43.0