xref: /openbmc/skeleton/rules.mk (revision 70852a38)
1.DEFAULT_GOAL := all
2sbindir=/usr/sbin
3
4LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS))
5ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS)
6
7BIN_SUFFIX?=.exe
8
9all: $(BINS:=$(BIN_SUFFIX))
10
11%.o: %.c
12	$(CC) -c $(ALL_CFLAGS) -o $@ $<
13
14$(BINS:=$(BIN_SUFFIX)): %$(BIN_SUFFIX): %.o $(EXTRA_OBJS)
15	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
16
17install: $(BINS:=$(BIN_SUFFIX))
18	@mkdir -p $(DESTDIR)$(sbindir)
19	@for b in $(BINS:=$(BIN_SUFFIX)); do \
20		install $$b $(DESTDIR)$(sbindir) || exit 1; \
21	done
22
23clean:
24	rm -rf *.o $(BINS:=$(BIN_SUFFIX))
25