X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=Makefile;h=87c7d29a0c35afa394764d523911a7d9d9c661d7;hb=c2e27a85d7a7b8d4ce734c88f9ff1493b87a5789;hp=7f598d548b6f62ee8d92fa66256642c3233578d9;hpb=7a5132c93cde8ce79bbea3dc4568ffa5f42ec5cf;p=osl.git diff --git a/Makefile b/Makefile index 7f598d5..87c7d29 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 @@ -22,9 +23,6 @@ executables := oslfsck man_pages := oslfsck.1 INSTALL := install -ifeq "$(origin CC)" "default" - CC := cc -endif MKDIR := mkdir -p RM := rm -f LN := ln @@ -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) @@ -150,8 +156,9 @@ www: web/index.html web/osl.png web/api.html web/osl.png: web/osl.pdf Makefile convert -scale 200x200 $< $@ -web/index.html: oslfsck.1 web/index.html.in INSTALL README QUICK_START - sed -e '/@README@/,$$d' web/index.html.in > $@ +web/index.html: oslfsck.1 web/header.html web/index.html.in INSTALL README QUICK_START + cat web/header.html > $@ + sed -e '/@README@/,$$d' web/index.html.in >> $@ markdown < README >> $@ sed -e '1,/@README@/d' -e '/@INSTALL@/,$$d' web/index.html.in >> $@ markdown < INSTALL >> $@