forked from openbmc/skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrules.mk
34 lines (26 loc) · 762 Bytes
/
rules.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
.DEFAULT_GOAL := all
sbindir=/usr/sbin
LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS))
ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS)
BIN_SUFFIX?=.exe
.PHONY: $(SUBDIRS)
all: $(BINS:=$(BIN_SUFFIX)) $(SUBDIRS)
%.o: %.c
$(CC) -c $(ALL_CFLAGS) -o $@ $<
$(SUBDIRS):
$(MAKE) -C $@
$(BINS:=$(BIN_SUFFIX)): %$(BIN_SUFFIX): %.o $(EXTRA_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
install: $(BINS:=$(BIN_SUFFIX))
@mkdir -p $(DESTDIR)$(sbindir)
@for b in $(BINS:=$(BIN_SUFFIX)); do \
install $$b $(DESTDIR)$(sbindir) || exit 1; \
done
@for d in $(SUBDIRS); do \
$(MAKE) -C $$d $@ || exit 1; \
done
clean:
rm -rf *.o $(BINS:=$(BIN_SUFFIX))
@for d in $(SUBDIRS); do \
$(MAKE) -C $$d $@ || exit 1; \
done