Merge pull request #13 from hasufell/patch-1

improve build system
This commit is contained in:
Christopher Jeffrey 2012-03-17 18:05:53 -07:00
commit efd5643858
1 changed files with 9 additions and 10 deletions

View File

@ -1,26 +1,25 @@
CC ?= gcc
PREFIX ?= /usr PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man/man1 MANDIR ?= $(PREFIX)/share/man/man1
PACKAGES = x11 xcomposite xfixes xdamage xrender PACKAGES = x11 xcomposite xfixes xdamage xrender
LIBS = `pkg-config --libs $(PACKAGES)` -lm LIBS = $(shell pkg-config --libs $(PACKAGES)) -lm
INCS = `pkg-config --cflags $(PACKAGES)` INCS = $(shell pkg-config --cflags $(PACKAGES))
CFLAGS = -Wall CFLAGS += -Wall
OBJS = compton.o OBJS = compton.o
%.o: src/%.c src/%.h %.o: src/%.c src/%.h
$(CC) $(CFLAGS) $(INCS) -c src/$*.c $(CC) $(CFLAGS) $(INCS) -c src/$*.c
compton: $(OBJS) compton: $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
install: compton install: compton
@[ -e "$(PREFIX)" ] || mkdir -p "$(PREFIX)" @install -Dm755 compton "$(BINDIR)"/compton
@[ -e "$(BINDIR)" ] || mkdir -p "$(BINDIR)" @install -Dm755 bin/settrans "$(BINDIR)"/settrans
@[ -e "$(MANDIR)" ] || mkdir -p "$(MANDIR)" @install -Dm644 man/compton.1 "$(MANDIR)"/compton.1
@cp compton "$(BINDIR)"
@cp bin/settrans "$(BINDIR)"
@cp man/compton.1 "$(MANDIR)"
uninstall: uninstall:
@rm -f "$(BINDIR)/compton" @rm -f "$(BINDIR)/compton"