X-Git-Url: http://git.tuebingen.mpg.de/osl.git/tree?a=blobdiff_plain;f=Makefile;h=6f5b391370e784330264a4a1febad3f77fa40dff;hb=HEAD;hp=fb8a01d3282a6fddf3a7b4866a0af198ab0dd2f6;hpb=f497ad60e2191188f6bef05d022a07d17c65a357;p=osl.git diff --git a/Makefile b/Makefile index fb8a01d..6f5b391 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,8 @@ # increases performance and avoids hard-to-debug behaviour. .SUFFIXES: MAKEFLAGS += -Rr -ifeq ("$(origin CC)", "default") +CC := $(CC) +ifeq ($(strip $(CC)),) CC := cc endif @@ -14,17 +15,14 @@ includedir := $(PREFIX)/include bindir := $(PREFIX)/bin mandir := $(PREFIX)/man/man1 -objects := osl.o util.o rbtree.o sha1.o -fsck_objects := fsck.o osl.o util.o rbtree.o sha1.o oslfsck.lsg.o +objects := osl.o util.o rbtree.o sha1.o sha3.o sha256.o +fsck_objects := fsck.o osl.o util.o rbtree.o sha1.o sha3.o sha256.o oslfsck.lsg.o deps := $(sort $(objects:.o=.d) $(fsck_objects:.o=.d)) headers := osl.h executables := oslfsck man_pages := oslfsck.1 INSTALL := install -ifeq "$(origin CC)" "default" - CC := cc -endif MKDIR := mkdir -p RM := rm -f LN := ln @@ -34,8 +32,8 @@ OBJCOPY := objcopy # libosl's versioning consists of three numbers. Let's call them x, y and z. x := 0 -y := 1 -z := 3 +y := 2 +z := 0 VERSION := $(x).$(y).$(z) OSL_CPPFLAGS += -DOSL_VERSION='"$(VERSION)"' @@ -83,12 +81,20 @@ ifeq ($(findstring clean, $(MAKECMDGOALS)),) -include $(deps) endif -# List osl.h in the prerequisites to make sure we generate it before attempting -# to run the compiler. This matters only when the .d file does not exist. -%.o: %.c osl.h Makefile errtab.h +# The files to generate before attempting to run the compiler. These +# are the order-only prerequisites in the rule below. +pre_deps := osl.h errtab.h oslfsck.lsg.h + +# The .d and .o files are both created from a single cc invocation. +define CC_CMD $(CC) $(OSL_CPPFLAGS) $(CPPFLAGS) \ - -c -MMD -MF $(*F).d -MT $@ \ + -c -MMD -MF $(*F).d -MT $(*F).o \ $(OSL_CFLAGS) $(CFLAGS) $< +endef +%.o: %.c Makefile | $(pre_deps) + $(CC_CMD) +%.d: %.c Makefile | $(pre_deps) + $(CC_CMD) fsck.o: oslfsck.lsg.h oslfsck: $(fsck_objects)