diff options
author | Mattias Andrée <maandree@kth.se> | 2019-10-22 15:04:45 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2019-10-22 15:04:45 +0200 |
commit | b13efce73e506b0feb4bb7c275c273a54ae6e716 (patch) | |
tree | 79f93e69b01d236e96037aa60332d214696e048b /Makefile | |
parent | Fix NULL-pointer bug in get_pathname when running with -mdrm (diff) | |
download | coopgammad-1.3.tar.gz coopgammad-1.3.tar.bz2 coopgammad-1.3.tar.xz |
Change license and style, reorganise file, make makefile portable, and fix bugs1.3
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | Makefile | 139 |
1 files changed, 38 insertions, 101 deletions
@@ -1,115 +1,52 @@ -PREFIX = /usr -BINDIR = $(PREFIX)/bin -DATADIR = $(PREFIX)/share -MANDIR = $(DATADIR)/man -MAN1DIR = $(MANDIR)/man1 -LICENSEDIR = $(DATADIR)/licenses +.POSIX: -PKGNAME = coopgammad -COMMAND = coopgammad +CONFIGFILE = config.mk +include $(CONFIGFILE) -KERNEL = $(shell uname | tr '[A-Z]_' '[a-z]-') +XCPPFLAGS = -D'PKGNAME="$(PKGNAME)"' -D'COMMAND="$(COMMAND)"' -SRC = \ - coopgammad \ - util \ - communication \ - state \ - servers/master \ - servers/kernel \ - servers/crtc \ - servers/gamma \ - servers/coopgamma \ - types/filter \ - types/output \ - types/ramps \ - types/message \ - types/ring +PARTS =\ + communication\ + state\ + util\ + servers-master\ + servers-kernel\ + servers-crtc\ + servers-gamma\ + servers-coopgamma\ + types-filter\ + types-output\ + types-ramps\ + types-message\ + types-ring -OPTIMISE = -O2 +OBJ = $(PARTS:=.o) coopgammad.c -WARN = -Wall -Wextra -pedantic +HDR = $(PARTS:=.h) arg.h -CPP_linux = -DHAVE_LINUX_PROCFS -CPP_linux-libre = $(CPP_linux) +all: coopgammad +$(OBJ): $(@:.o=.c) $(HDR) -CCFLAGS = -std=c99 $(WARN) $(FFLAGS) $(OPTIMISE) -LDFLAGS = $(OPTIMISE) -lgamma -CPPFLAGS = -D'PKGNAME="$(PKGNAME)"' -D'COMMAND="$(COMMAND)"' -D_XOPEN_SOURCE=700 $(CPP_$(KERNEL)) -ifdef USE_VALGRIND -CPPFLAGS += -DUSE_VALGRIND -endif +.c.o: + $(CC) -c -o $@ $< $(XCPPFLAGS) $(CPPFLAGS) $(CFLAGS) +coopgammad: $(OBJ) + $(CC) -o $@ $(OBJ) $(LDFLAGS) +install: coopgammad + mkdir -p -- "$(DESTDIR)$(PREFIX)/bin" + mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1" + cp -- coopgammad "$(DESTDIR)$(PREFIX)/bin/coopgammad" + cp -- coopgammad.1 "$(DESTDIR)$(MANPREFIX)/man1/coopgammad.1" -.PHONY: all -all: bin/coopgammad - -.PHONY: base -base: cmd - -.PHONY: cmd -cmd: bin/coopgammad - -bin/coopgammad: $(foreach S,$(SRC),obj/$(S).o) - @mkdir -p -- "$$(dirname -- "$@")" - $(CC) $(LDFLAGS) -o $@ $^ - -obj/%.o: src/%.c src/*.h src/*/*.h - @mkdir -p -- "$$(dirname -- "$@")" - $(CC) $(CCFLAGS) $(CPPFLAGS) -c -o $@ $< - - - -.PHONY: install -install: install-base install-doc - -.PHONY: install-base -install-base: install-cmd install-copyright - -.PHONY: install-copyright -install-copyright: install-license install-copying - -.PHONY: install-doc -install-doc: install-man - -.PHONY: install-cmd -install-cmd: bin/coopgammad - mkdir -p -- "$(DESTDIR)$(BINDIR)" - cp -- bin/coopgammad "$(DESTDIR)$(BINDIR)/$(COMMAND)" - chmod 0755 -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" - -.PHONY: install-license -install-license: - mkdir -p -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" - cp -- LICENSE "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" - chmod 0644 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" - -.PHONY: install-copying -install-copying: - mkdir -p -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" - cp -- COPYING "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" - chmod 0644 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" - -.PHONY: install-man -install-man: - mkdir -p -- "$(DESTDIR)$(MAN1DIR)" - cp -- doc/coopgammad.1 "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" - chmod 644 -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" - - - -.PHONY: uninstall uninstall: - -rm -- "$(DESTDIR)$(MAN1DIR)/$(COMMAND).1" - -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING" - -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE" - -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)" - -rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)" - + -rm -f -- "$(DESTDIR)$(MANPREFIX)/man1/coopgammad.1" + -rm -f -- "$(DESTDIR)$(PREFIX)/bin/coopgammad" - -.PHONY: clean clean: - -rm -r bin obj + -rm -rf -- coopgammad *.o *.su + +.SUFFIXES: +.SUFFIXES: .o .c +.PHONY: all install uninstall clean |