-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
60 lines (39 loc) · 1.22 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
##############################################
# Makefile for kidsmath app
#
###############################################
MEMMAN_HOME = $(shell pwd)
BIN_PATH = $(MEMMAN_HOME)/bin
INC_PATH = $(MEMMAN_HOME)/inc
CROSS_TOOL =
AS = $(CROSS_TOOL)as
CC = $(CROSS_TOOL)gcc
LD = $(CROSS_TOOL)ld
OD = $(CROSS_TOOL)objdump
OC = $(CROSS_TOOL)objcopy
AR = $(CROSS_TOOL)ar
RM := rm -f
################################################
################################################
app := $(BIN_PATH)/kidsmath
sources := src/main.c \
src/bitcolumnmatrix.c \
src/maths.c \
src/simplerandom.c \
src/simplerandom-discard.c \
################################################
objects := $(subst .c,.o,$(sources))
dependencies := $(subst .c,.d,$(sources))
include_dirs := $(INC_PATH)
CFLAGS += -std=gnu99 -I $(include_dirs) -lm -L/usr/lib/x86_64-linux-gnu/ -lreadline -lncurses -g
################################################
.PHONY: all $(app)
all: $(app)
$(app): $(objects)
$(CC) $^ $(CFLAGS) -o $@
clean:
$(RM) $(app) $(objects) $(dependencies)
################################################
%.d: %.c
$(SHELL) -ec '$(CC) -M $(CFLAGS) $< | sed '\''s,$(notdir $*).o,& $@,g'\'' > $@'
-include $(sources:.c=.d)