-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
45 lines (31 loc) · 865 Bytes
/
Makefile
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
-include config.mak
GOAL = bf_firm
FIRM_CFLAGS ?= `pkg-config --cflags libfirm`
FIRM_LIBS ?= `pkg-config --libs libfirm`
CFLAGS += -Wall -W -Werror -O0 -g3 -std=c99
CFLAGS += -I .
CFLAGS += $(FIRM_CFLAGS) $(ADDCFLAGS)
LFLAGS = $(FIRM_LIBS)
SOURCES := main.c
OBJECTS = $(SOURCES:%.c=build/%.o)
Q = @
.PHONY : all clean dirs
all: $(GOAL)
ifeq ($(findstring $(MAKECMDGOALS), clean depend),)
-include .depend
endif
.depend: $(SOURCES)
@echo "===> DEPEND"
@rm -f $@ && touch $@ && makedepend -p "$@ build/" -Y -f $@ -- $(CFLAGS) -- $(SOURCES) 2> /dev/null && rm [email protected]
$(GOAL): build/adt $(OBJECTS)
@echo "===> LD $@"
$(Q)$(CC) -rdynamic $(OBJECTS) $(LFLAGS) -o $(GOAL)
build/adt:
@echo "===> MKDIR $@"
$(Q)mkdir -p $@
build/%.o: %.c
@echo '===> CC $<'
$(Q)$(CC) $(CFLAGS) -c $< -o $@
clean:
@echo '===> CLEAN'
$(Q)rm -rf build $(GOAL) .depend