15317bbafSopenharmony_ci# 
25317bbafSopenharmony_ci# Makefile for QR Code generator (C)
35317bbafSopenharmony_ci# 
45317bbafSopenharmony_ci# Copyright (c) Project Nayuki. (MIT License)
55317bbafSopenharmony_ci# https://www.nayuki.io/page/qr-code-generator-library
65317bbafSopenharmony_ci# 
75317bbafSopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy of
85317bbafSopenharmony_ci# this software and associated documentation files (the "Software"), to deal in
95317bbafSopenharmony_ci# the Software without restriction, including without limitation the rights to
105317bbafSopenharmony_ci# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
115317bbafSopenharmony_ci# the Software, and to permit persons to whom the Software is furnished to do so,
125317bbafSopenharmony_ci# subject to the following conditions:
135317bbafSopenharmony_ci# - The above copyright notice and this permission notice shall be included in
145317bbafSopenharmony_ci#   all copies or substantial portions of the Software.
155317bbafSopenharmony_ci# - The Software is provided "as is", without warranty of any kind, express or
165317bbafSopenharmony_ci#   implied, including but not limited to the warranties of merchantability,
175317bbafSopenharmony_ci#   fitness for a particular purpose and noninfringement. In no event shall the
185317bbafSopenharmony_ci#   authors or copyright holders be liable for any claim, damages or other
195317bbafSopenharmony_ci#   liability, whether in an action of contract, tort or otherwise, arising from,
205317bbafSopenharmony_ci#   out of or in connection with the Software or the use or other dealings in the
215317bbafSopenharmony_ci#   Software.
225317bbafSopenharmony_ci# 
235317bbafSopenharmony_ci
245317bbafSopenharmony_ci
255317bbafSopenharmony_ci# ---- Configuration options ----
265317bbafSopenharmony_ci
275317bbafSopenharmony_ci# External/implicit variables:
285317bbafSopenharmony_ci# - CC: The C compiler, such as gcc or clang.
295317bbafSopenharmony_ci# - CFLAGS: Any extra user-specified compiler flags (can be blank).
305317bbafSopenharmony_ci
315317bbafSopenharmony_ci# Recommended compiler flags:
325317bbafSopenharmony_ciCFLAGS += -std=c99 -O
335317bbafSopenharmony_ci
345317bbafSopenharmony_ci# Extra flags for diagnostics:
355317bbafSopenharmony_ci# CFLAGS += -g -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -fsanitize=undefined,address
365317bbafSopenharmony_ci
375317bbafSopenharmony_ci
385317bbafSopenharmony_ci# ---- Controlling make ----
395317bbafSopenharmony_ci
405317bbafSopenharmony_ci# Clear default suffix rules
415317bbafSopenharmony_ci.SUFFIXES:
425317bbafSopenharmony_ci
435317bbafSopenharmony_ci# Don't delete object files
445317bbafSopenharmony_ci.SECONDARY:
455317bbafSopenharmony_ci
465317bbafSopenharmony_ci# Stuff concerning goals
475317bbafSopenharmony_ci.DEFAULT_GOAL = all
485317bbafSopenharmony_ci.PHONY: all clean
495317bbafSopenharmony_ci
505317bbafSopenharmony_ci
515317bbafSopenharmony_ci# ---- Targets to build ----
525317bbafSopenharmony_ci
535317bbafSopenharmony_ciLIB = qrcodegen
545317bbafSopenharmony_ciLIBFILE = lib$(LIB).a
555317bbafSopenharmony_ciLIBOBJ = qrcodegen.o
565317bbafSopenharmony_ciMAINS = qrcodegen-demo qrcodegen-test
575317bbafSopenharmony_ci
585317bbafSopenharmony_ci# Build all binaries
595317bbafSopenharmony_ciall: $(LIBFILE) $(MAINS)
605317bbafSopenharmony_ci
615317bbafSopenharmony_ci# Delete build output
625317bbafSopenharmony_ciclean:
635317bbafSopenharmony_ci	rm -f -- $(LIBOBJ) $(LIBFILE) $(MAINS:=.o) $(MAINS)
645317bbafSopenharmony_ci	rm -rf .deps
655317bbafSopenharmony_ci
665317bbafSopenharmony_ci# Executable files
675317bbafSopenharmony_ci%: %.o $(LIBFILE)
685317bbafSopenharmony_ci	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L . -l $(LIB)
695317bbafSopenharmony_ci
705317bbafSopenharmony_ci# Special executable
715317bbafSopenharmony_ciqrcodegen-test: qrcodegen-test.c $(LIBOBJ:%.o=%.c)
725317bbafSopenharmony_ci	$(CC) $(CFLAGS) $(LDFLAGS) -DQRCODEGEN_TEST -o $@ $^
735317bbafSopenharmony_ci
745317bbafSopenharmony_ci# The library
755317bbafSopenharmony_ci$(LIBFILE): $(LIBOBJ)
765317bbafSopenharmony_ci	$(AR) -crs $@ -- $^
775317bbafSopenharmony_ci
785317bbafSopenharmony_ci# Object files
795317bbafSopenharmony_ci%.o: %.c .deps/timestamp
805317bbafSopenharmony_ci	$(CC) $(CFLAGS) -c -o $@ -MMD -MF .deps/$*.d $<
815317bbafSopenharmony_ci
825317bbafSopenharmony_ci# Have a place to store header dependencies automatically generated by compiler
835317bbafSopenharmony_ci.deps/timestamp:
845317bbafSopenharmony_ci	mkdir -p .deps
855317bbafSopenharmony_ci	touch .deps/timestamp
865317bbafSopenharmony_ci
875317bbafSopenharmony_ci# Make use of said dependencies if available
885317bbafSopenharmony_ci-include .deps/*.d
89