Another approach, from a small project of mine:
I think I went a little overboard. But if your project gets too large, then it's time to switch to Autotools, where angels fear to tread.Code:SHELL = /bin/sh CC = gcc CFLAGS = -Wall GTKFLAGS = `pkg-config --cflags gtk+-2.0` LDFLAGS = `pkg-config --libs gtk+-2.0` SRCS = gtkss.c OBJS = gtkss.o FILES = $(SRCS) README INSTALL COPYING AUTHORS NEWS ChangeLog Makefile PROG = gtkss VERSION = 0.1 prefix = /usr/local exec_prefix = $(prefix) bindir = $(exec_prefix)/bin %.o: %.c $(CC) -c $(CFLAGS) $(GTKFLAGS) $< $(PROG): $(OBJS) $(CC) $(LDFLAGS) $(OBJS) -o $@ all: $(PROG) $(PROG).tar.gz: @mkdir $(PROG)-$(VERSION) @cp $(FILES) $(PROG)-$(VERSION) @tar --numeric-owner -czf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION) @rm -rf $(PROG)-$(VERSION) @echo Distribution complete! dist: $(PROG).tar.gz install: @cp -f $(PROG) $(bindir) @echo Installation complete! .PHONY : clean clean: @-rm -f $(OBJS) $(PROG) @echo Clean complete!
Bookmarks