forked from abiggerhammer/hammer
-
Notifications
You must be signed in to change notification settings - Fork 40
/
common.mk
48 lines (34 loc) · 1.05 KB
/
common.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
ifneq ($(REALLY_USE_OBSOLETE_BUILD_SYSTEM),yes)
$(error This is the old build system. Use "scons" to build, or use $(MAKE) REALLY_USE_OBSOLETE_BUILD_SYSTEM=yes)
endif
# Check to make sure variables are properly set
ifeq ($(TOPLEVEL),)
$(error $$TOPLEVEL is unset)
endif
include $(TOPLEVEL)/config.mk
TEST_CFLAGS = $(shell pkg-config --cflags glib-2.0) -DINCLUDE_TESTS
TEST_LDFLAGS = $(shell pkg-config --libs glib-2.0) -lrt -ldl
CFLAGS := -std=gnu99 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes -g
LDFLAGS :=
CC ?= gcc
$(info CC=$(CC))
# Set V=1 for verbose mode...
V ?= 0
CFLAGS += $(EXTRA_CFLAGS)
HUSH = $(TOPLEVEL)/lib/hush
ifsilent = $(if $(findstring 0, $(V)),$(1),)
hush = $(call ifsilent,$(HUSH) $(1))
#.SUFFIXES:
ifeq ($(V),0)
.SILENT:
endif
.DEFAULT_GOAL:=all
%.a: $(call ifsilent,| $(HUSH))
-rm -f $@
$(call hush,"Archiving $@") ar cr $@ $^
%.o: %.c $(call ifsilent,| $(HUSH))
$(call hush, "Compiling $<") $(CC) $(CFLAGS) -c -o $@ $<
clean:
-rm -f $(OUTPUTS)
$(TOPLEVEL)/lib/hush: $(TOPLEVEL)/lib/hush.c
make -C $(TOPLEVEL)/lib hush