123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- include ../make.inc
- CFLAGS += $(BASE_CFLAGS) -flto $(WARN_CFLAGS)
- LDFLAGS ?=
- LIBS ?= -lX11 -lXi
- BIN = pwrtray-xevrep
- SRCS = main.c
- V = @ # Verbose build: make V=1
- Q = $(V:1=)
- QUIET_CC = $(Q:@=@echo ' CC '$@;)$(CC)
- QUIET_DEPEND = $(Q:@=@echo ' DEPEND '$@;)$(CC)
- DEPS = $(patsubst %.c,dep/%.d,$(1))
- OBJS = $(patsubst %.c,obj/%.o,$(1))
- .SUFFIXES:
- .PHONY: all install clean
- .DEFAULT_GOAL := all
- $(call DEPS,$(SRCS)): dep/%.d: %.c
- @mkdir -p $(dir $@)
- $(QUIET_DEPEND) -o $@.tmp -MM -MT "$@ $(patsubst dep/%.d,obj/%.o,$@)" $(CFLAGS) $< && mv -f $@.tmp $@
- -include $(call DEPS,$(SRCS))
- $(call OBJS,$(SRCS)): obj/%.o:
- @mkdir -p $(dir $@)
- $(QUIET_CC) -o $@ -c $(CFLAGS) $<
- all: $(BIN)
- $(BIN): $(call OBJS,$(SRCS))
- $(QUIET_CC) $(CFLAGS) -o $(BIN) $(LDFLAGS) $(LIBS) $(call OBJS,$(SRCS))
- clean:
- rm -Rf dep obj core *~ $(BIN)
- install: $(BIN)
- $(INSTALL) -d -m755 $(DESTDIR)$(PREFIX)/bin/
- $(INSTALL) -m755 $(BIN) $(DESTDIR)$(PREFIX)/bin/
|