-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
47 lines (34 loc) · 902 Bytes
/
makefile
File metadata and controls
47 lines (34 loc) · 902 Bytes
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
# Core project makefile
SHELL = /bin/sh
$(shell mkdir -p obj)
$(shell mkdir -p obj/inc)
ODIR = obj
INCDIR = $(ODIR)/inc
SUBDIRS = kernel/ onewire-adapter/ ui-module/
#IDIRS := . $(SUBDIRS) $(INCDIR)
#CFLAGS := $(foreach dir,$(IDIRS),-I$(dir))
CFLAGS := -I$(INCDIR)
CC = gcc
SOURCES = main
#_DEPS = headers.h
#DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))
#_OBJ = main.o
#OBJ := $(patsubst %,$(ODIR)/%,$(_OBJ))
#$(ODIR)/%.o: %.c $(DEPS)
# $(CC) -c -o $@ $< $(CFLAGS)
.PHONY: clean all
export ODIR
export INCDIR
app: setup
$(CC) -o $(ODIR)/$@ $(shell find $(ODIR)/ -type f -name \*.o) $(LIBS)
all: setup
$(CC) -o $(ODIR)/app $(shell find $(ODIR)/ -type f -name \*.o) $(LIBS)
setup:
for dir in $(SUBDIRS) ; do \
$(MAKE) -C $$dir ; \
done
for SOURCE in $(SOURCES) ; do \
$(CC) -c $$SOURCE.c $(CFLAGS) -o $(ODIR)/$$SOURCE.o ; \
done
clean:
rm -f $(ODIR)/*.o $(ODIR)/app core $(INCDIR)/*.h