hammer/common.mk

39 lines
735 B
Makefile
Raw Normal View History

2012-04-30 23:35:11 +01:00
CFLAGS := $(shell pkg-config --cflags glib-2.0) -std=gnu99 -Wall -Wextra -Werror
LDFLAGS := $(shell pkg-config --libs glib-2.0)
CC := gcc
2012-04-30 23:35:11 +01:00
# Set V=1 for verbose mode...
V := 0
CFLAGS += -DINCLUDE_TESTS
2012-04-30 23:35:11 +01:00
HUSH = $(TOPLEVEL)/lib/hush
# Check to make sure variables are properly set
ifeq ($(TOPLEVEL),)
$(error $$TOPLEVEL is unset)
endif
#.SUFFIXES:
2012-04-30 23:35:11 +01:00
ifeq ($(V),0)
.SILENT:
endif
.DEFAULT_GOAL:=all
2012-04-30 23:35:11 +01:00
%.a: | $(HUSH)
-rm -f $@
2012-04-30 23:35:11 +01:00
$(if $(findstr 0,$(V)),$(HUSH) "Archiving $@",) ar cr $@ $^
2012-04-30 23:35:11 +01:00
ifeq ($(V),0)
# silent mode
%.o: %.c | $(HUSH)
$(HUSH) "Compiling $<" $(CC) $(CFLAGS) -c -o $@ $<
else
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
2012-04-30 23:35:11 +01:00
endif
clean:
-rm -f $(OUTPUTS)
2012-04-30 23:35:11 +01:00
$(TOPLEVEL)/lib/hush: $(TOPLEVEL)/lib/hush.c
make -C $(TOPLEVEL)/lib hush