diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2020-02-03 21:01:22 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2020-02-03 21:01:22 +0300 |
commit | 55e11567a2eabcc1f34955062cef5610d16400fb (patch) | |
tree | 2bfcf0a84f543a6aacaa47e27831d7874dcd4e7e /Makefile | |
parent | c299128eaefc813d1a6acdca8a9c724145686177 (diff) | |
download | magi-55e11567a2eabcc1f34955062cef5610d16400fb.tar magi-55e11567a2eabcc1f34955062cef5610d16400fb.tar.xz magi-55e11567a2eabcc1f34955062cef5610d16400fb.zip |
[magi] Makefile update.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 41 |
1 files changed, 32 insertions, 9 deletions
@@ -1,35 +1,58 @@ -# Debug mode: +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Compilation Options +# Debug mode (uncoment to be able to debug the library via gdb): # DEBUG = yes - +# Specify your favourite C compiler here (e.g. tcc): CC = gcc + + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Preparations LIB = libmagi.a +# Compile under the most strict conditions: CFLAGS = -xc -ansi -pedantic -Wall +# Debug and optimisation are not compatible: ifeq '$(DEBUG)' 'yes' CFLAGS += -g -O0 else CFLAGS += -O3 endif +# Object files listing: SRC_DIR = src SRC = $(wildcard $(SRC_DIR)/*.c) OBJ = $(SRC:.c=.o) +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Targets +# 'make' will produce library by default: default: $(LIB) -ifneq "clean" "$(MAKECMDGOALS)" --include deps.mk -endif +# Cleaning means removing everything automatically produced: +clean: + rm -f $(OBJ) $(LIB) deps.mk -deps.mk: $(SRC) - $(CC) -MM $^ > $@ +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Compilation +# Compile object files from corresponding source and header: %.o: %.c %.h $(CC) $(CFLAGS) -c $< -o $@ +# Packing object files into library: $(LIB): $(OBJ) ar rcs $@ $^ -clean: - rm -f $(OBJ) $(LIB) deps.mk + +# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +# Dependencies +# Generating dependencies description file: +deps.mk: $(SRC) + $(CC) -MM $^ > $@ + +# While cleaning we need to remove it, not include: +ifneq "clean" "$(MAKECMDGOALS)" +-include deps.mk +endif |