-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRules.make
More file actions
49 lines (36 loc) · 976 Bytes
/
Rules.make
File metadata and controls
49 lines (36 loc) · 976 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
48
49
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)gcc
IFLAGS = -I$(TOPDIR)/include
OFLAGS = -ggdb -O2 -fomit-frame-pointer
CPPFLAGS += -Wall -Wno-unused-local-typedefs $(IFLAGS) $(OFLAGS)
CFLAGS += $(CPPFLAGS) #use ptx incdir for libs
LIBS += -lm
SRCS += $(wildcard *.c) $(wildcard *.cpp)
HDRS += $(wildcard *.h)
HDRS += $(wildcard $(TOPDIR)/include/*.h)
.PHONY: all all_rec clean clean_rec
ifdef SUBDIRS
all: all_rec
else
all: .depend $(TARGET)
endif
all_rec:
ifdef SUBDIRS
for i in $(SUBDIRS); do $(MAKE) -C $$i $(subst _rec,,$@) || exit 1; done
endif
$(TARGET): $(OBJS)
$(LD) -o $(TARGET) $(filter $(OBJS), $^) $(LDFLAGS) $(LIBS)
clean: clean_gen clean_rec
clean_gen:
$(RM) $(TARGET) $(OBJS) *.o .depend
clean_rec:
ifdef SUBDIRS
for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done
endif
%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<
.depend: $(SRCS) $(HDRS)
ifneq ($(strip $(SRCS)),)
$(CC) -MM -MP -MG -MF .depend $(CFLAGS) $(SRCS)
endif
-include .depend