From d56550803103c04f40bac78b65970b000bcb9099 Mon Sep 17 00:00:00 2001 From: nishi Date: Thu, 8 Feb 2024 15:11:35 +0000 Subject: [PATCH] better makefile git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@185 d27a3e52-49c5-7645-884c-6793ebffc270 --- Makefile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e9cde08..c6c43c3 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,24 @@ # $Id$ include config.mk +PREFIX := /usr/local +PKGCONF := pkg-config + +ifeq ("$(wildcard cache.mk)","") +$(info Creating cache.mk) +IGNORE := $(shell echo "PREFIX=$(PREFIX)" > cache.mk) +IGNORE := $(shell echo "TCL_PKGCONF=$(TCL_PKGCONF)" >> cache.mk) +include cache.mk +else +include cache.mk +endif + ifeq ($(shell uname -s),SunOS) GREP = ggrep else GREP = grep endif -PKGCONF := pkg-config - ifeq ($(TCL),YES) ifneq ($(TCL_PKGCONF),NO) TCL_CFLAGS += $(shell $(PKGCONF) --cflags tcl) -DTCL_BINDING @@ -22,7 +32,6 @@ CC := cc CFLAGS := -g -std=c99 -fPIC -D_XOPEN_SOURCE=600 $(TCL_CFLAGS) LDFLAGS := LIBS := $(TCL_LIBS) -PREFIX := /usr/local VERSION = $(shell cat Library/W3Version.h | $(GREP) -m 1 LIBW3_VERSION | sed -E "s/.+\"([^\"]+)\".+/\1/g")$(shell cat Library/W3Version.h | grep -A 1 -E "LIBW3_VERSION" | sed "s/LIBW3_VERSION//g" | tail -n1 | grep -Eo "W") ifeq ($(SSL),YES) @@ -114,7 +123,7 @@ endif echo "Libs: -L\$${libdir} -lw3" >> $@ clean: - -rm -f ./w3.pc w3-*.zip w3-*.tar.gz w3-*.lzh ./Library/W3Version.h *~ + -rm -f ./w3.pc w3-*.zip w3-*.tar.gz w3-*.lzh ./Library/W3Version.h *~ cache.mk $(MAKE) -C ./Library clean $(MAKE) -C ./Example clean -- 2.43.0