From a5ec437e91f90f25711c7e1b47b8238fdae6b103 Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Wed, 16 Oct 2019 18:37:32 +0300 Subject: [magi] Cosmetic fixes. --- Makefile | 40 ++++++++++++++++++++++++++++++++++++++++ examples/Makefile | 29 +++++++++++++++++++++++++++++ examples/append.c | 4 ++-- examples/makefile | 24 ------------------------ examples/upload.c | 6 +++--- makefile | 40 ---------------------------------------- 6 files changed, 74 insertions(+), 69 deletions(-) create mode 100644 Makefile create mode 100644 examples/Makefile delete mode 100644 examples/makefile delete mode 100644 makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9585f98 --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ +# Debug mode: +# DEBUG = yes +# Error logging (writes to stderr): +# ERRLOG = yes + +CC = gcc +LIB = libmagi.a + +CFLAGS = -xc -ansi -pedantic -Wall +ifeq '$(DEBUG)' 'yes' +CFLAGS += -g -O0 +else +CFLAGS += -O3 +endif +ifeq '$(ERRLOG)' 'yes' +CFLAGS += -D ERRLOG +endif + +SRC_DIR = src +SRC = $(wildcard $(SRC_DIR)/*.c) +OBJ = $(SRC:.c=.o) + + +default: $(LIB) + +ifneq "clean" "$(MAKECMDGOALS)" +-include deps.mk +endif + +deps.mk: $(SRC) + $(CC) -MM $^ > $@ + +%.o: %.c %.h + $(CC) $(CFLAGS) -c $< -o $@ + +$(LIB): $(OBJ) + ar rcs $@ $^ + +clean: + rm -f $(OBJ) $(LIB) deps.mk diff --git a/examples/Makefile b/examples/Makefile new file mode 100644 index 0000000..d93176b --- /dev/null +++ b/examples/Makefile @@ -0,0 +1,29 @@ +# Uncomment following to enable debug mode: +# DEBUG = yes + +CC = gcc +EXAMPLES = append cookie upload echo + +CFLAGS = -xc -ansi -pedantic -Wall +ifeq '$(DEBUG)' 'yes' +CFLAGS += -g -O0 +else +CFLAGS += -O3 +endif + +INCLUDE = -I ../src +LFLAGS = -L.. -lmagi + +MAGI = ../libmagi.a + + +default: $(EXAMPLES) + +$(MAGI): + cd ..; $(MAKE) + +%: %.c $(MAGI) + $(CC) $(CFLAGS) $(INCLUDE) $< $(LFLAGS) -o $@ + +clean: + rm -f $(EXAMPLES) diff --git a/examples/append.c b/examples/append.c index f0dfe2a..65caa33 100644 --- a/examples/append.c +++ b/examples/append.c @@ -30,10 +30,10 @@ void print_webpage() "" "Append to File" "" - "
" + "
" "" "" - "" + "
" "" "" ); diff --git a/examples/makefile b/examples/makefile deleted file mode 100644 index e3205aa..0000000 --- a/examples/makefile +++ /dev/null @@ -1,24 +0,0 @@ -# Uncomment following to enable debug mode: -# DEBUG = yes - -CC = gcc -EXAMPLES = append cookie upload echo - -CFLAGS = -xc -ansi -pedantic -Wall -ifeq '$(DEBUG)' 'yes' -CFLAGS += -g -O0 -else -CFLAGS += -O3 -endif - -INCLUDE = -I ../src -LFLAGS = -L.. -lmagi - - -default: $(EXAMPLES) - -%: %.c - $(CC) $(CFLAGS) $(INCLUDE) $< $(LFLAGS) -o $@ - -clean: - rm -f $(EXAMPLES) diff --git a/examples/upload.c b/examples/upload.c index 9dc1efd..1dc9659 100644 --- a/examples/upload.c +++ b/examples/upload.c @@ -53,12 +53,12 @@ void print_webpage() "" "Upload File" "" - "
" + "
" "" "" "" - "" + "
" "" "" ); diff --git a/makefile b/makefile deleted file mode 100644 index 9585f98..0000000 --- a/makefile +++ /dev/null @@ -1,40 +0,0 @@ -# Debug mode: -# DEBUG = yes -# Error logging (writes to stderr): -# ERRLOG = yes - -CC = gcc -LIB = libmagi.a - -CFLAGS = -xc -ansi -pedantic -Wall -ifeq '$(DEBUG)' 'yes' -CFLAGS += -g -O0 -else -CFLAGS += -O3 -endif -ifeq '$(ERRLOG)' 'yes' -CFLAGS += -D ERRLOG -endif - -SRC_DIR = src -SRC = $(wildcard $(SRC_DIR)/*.c) -OBJ = $(SRC:.c=.o) - - -default: $(LIB) - -ifneq "clean" "$(MAKECMDGOALS)" --include deps.mk -endif - -deps.mk: $(SRC) - $(CC) -MM $^ > $@ - -%.o: %.c %.h - $(CC) $(CFLAGS) -c $< -o $@ - -$(LIB): $(OBJ) - ar rcs $@ $^ - -clean: - rm -f $(OBJ) $(LIB) deps.mk -- cgit v1.2.3