42 lines
642 B
Makefile
42 lines
642 B
Makefile
ifndef verbose
|
|
SILENT = @
|
|
endif
|
|
|
|
CC := gcc
|
|
AR := ar
|
|
CFLAGS := -I include/
|
|
|
|
ifeq ($(colorized), y)
|
|
CFLAGS += -D COLORIZED
|
|
endif
|
|
|
|
ifeq ($(no_banner), y)
|
|
CFLAGS += -D NO_BANNER
|
|
endif
|
|
|
|
ifeq ($(testing), y)
|
|
CFLAGS += -g2 -O0
|
|
else
|
|
CFLAGS += -O2
|
|
endif
|
|
|
|
all: create_output_dir libset.a
|
|
|
|
clean:
|
|
$(SILENT) rm -rf int/
|
|
$(SILENT) rm -f libset.a
|
|
|
|
create_output_dir:
|
|
$(SILENT) mkdir -p int/
|
|
|
|
libset.a: $(patsubst src/%.c, int/%.o, $(wildcard src/*.c))
|
|
@echo "Archiving $^ to $@"
|
|
$(SILENT) $(AR) rcs $@ int/**.o
|
|
|
|
# Recipe
|
|
int/%.o: src/%.c
|
|
@echo "Building $< => $@"
|
|
$(SILENT) $(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
.PHONY: all clean test create_output_dir
|