2000-02-17 20:38:33 +01:00
|
|
|
# Makefile.common - common definitions for the winsup directory
|
|
|
|
#
|
2001-02-21 23:59:11 +01:00
|
|
|
# Copyright 2000, 2001 Red Hat, Inc.
|
2000-02-17 20:38:33 +01:00
|
|
|
#
|
|
|
|
# This file is part of Cygwin.
|
|
|
|
#
|
|
|
|
# This software is a copyrighted work licensed under the terms of the
|
|
|
|
# Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
# details.
|
|
|
|
|
|
|
|
# This makefile requires GNU make.
|
|
|
|
|
2002-12-21 06:06:24 +01:00
|
|
|
CFLAGS_COMMON:=-Wall -Wwrite-strings -fno-common -pipe -Winline -fbuiltin -fmessage-length=0# -finline-functions
|
2000-10-23 00:43:47 +02:00
|
|
|
MALLOC_DEBUG:=#-DMALLOC_DEBUG -I/cygnus/src/uberbaum/winsup/cygwin/dlmalloc
|
|
|
|
MALLOC_OBJ:=#/cygnus/src/uberbaum/winsup/cygwin/dlmalloc/malloc.o
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2000-04-18 02:37:04 +02:00
|
|
|
override srcdir:=${shell cd $(srcdir); pwd}
|
2000-04-10 05:51:39 +02:00
|
|
|
ifneq (,${filter-out /%,$(srcdir)})
|
2000-02-17 20:38:33 +01:00
|
|
|
updir:=$(srcdir)/..
|
|
|
|
updir1:=$(updir)/..
|
|
|
|
else
|
|
|
|
updir:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(srcdir)):::}}
|
|
|
|
ifneq (,${findstring /,$(updir)})
|
|
|
|
updir1:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(updir)):::}}
|
|
|
|
else
|
|
|
|
updir1:=$(updir)/..
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
pwd:=${shell pwd}
|
2001-05-15 07:11:55 +02:00
|
|
|
ifneq "${filter winsup%,${notdir $(pwd)}}" ""
|
|
|
|
a:=${shell ${filter winsup%,${notdir $(pwd)}} >/dev/tty}
|
|
|
|
here:=${pwd}/cygwin
|
|
|
|
else
|
|
|
|
a:=${shell ${filter winsup%,${notdir $(pwd)}} >/dev/tty}
|
|
|
|
here:=${dir $(pwd)}cygwin
|
|
|
|
endif
|
2000-09-01 16:20:30 +02:00
|
|
|
bupdir:=${shell cd $(here)/..; pwd}
|
|
|
|
ifneq (,${filter-out /%,$(bupdir)})
|
2000-02-17 20:38:33 +01:00
|
|
|
bupdir1:=../..
|
2000-08-24 21:05:38 +02:00
|
|
|
bupdir2:=../../..
|
2000-02-17 20:38:33 +01:00
|
|
|
else
|
|
|
|
ifneq (,${findstring /,$(bupdir)})
|
|
|
|
bupdir1:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(bupdir)):::}}
|
|
|
|
else
|
|
|
|
bupdir1:=$(bupdir)/..
|
|
|
|
endif
|
2000-08-24 21:05:38 +02:00
|
|
|
ifneq (,${findstring /,$(bupdir1)})
|
|
|
|
bupdir2:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(bupdir1)):::}}
|
|
|
|
else
|
|
|
|
bupdir2:=$(bupdir1)/..
|
|
|
|
endif
|
2000-02-17 20:38:33 +01:00
|
|
|
endif
|
|
|
|
|
2001-12-14 19:23:19 +01:00
|
|
|
zlib_source:=$(updir)/zlib
|
|
|
|
zlib_build:=$(bupdir)/zlib
|
|
|
|
bz2lib_source:=$(updir)/bz2lib
|
|
|
|
bz2lib_build:=$(bupdir)/bz2lib
|
2000-02-17 20:38:33 +01:00
|
|
|
w32api_source:=$(updir)/w32api
|
|
|
|
w32api_build:=$(bupdir)/w32api
|
2001-10-10 03:57:43 +02:00
|
|
|
ifeq (,${findstring $(w32api_source),$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
|
|
|
|
w32api_include:=-I$(w32api_source)/include
|
|
|
|
endif
|
2000-02-17 20:38:33 +01:00
|
|
|
w32api_lib:=$(w32api_build)/lib
|
|
|
|
newlib_source:=$(updir1)/newlib
|
|
|
|
newlib_build:=$(bupdir1)/newlib
|
|
|
|
cygwin_build:=$(bupdir)/cygwin
|
|
|
|
cygwin_source:=$(updir)/cygwin
|
|
|
|
mingw_build:=$(bupdir)/mingw
|
|
|
|
mingw_source:=$(updir)/mingw
|
|
|
|
utils_build:=$(bupdir)/utils
|
|
|
|
utils_source:=$(updir)/utils
|
2001-10-12 14:52:05 +02:00
|
|
|
ifeq (,${findstring $(newlib_source)/libc/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
|
2001-10-10 03:57:43 +02:00
|
|
|
newlib_include:=-I$(newlib_source)/libc/include
|
2001-10-12 14:52:05 +02:00
|
|
|
endif
|
|
|
|
ifeq (,${findstring $(newlib_source)/libc/sys/cygwin,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
|
|
|
|
newlib_sys_include:=-I$(newlib_source)/libc/sys/cygwin
|
|
|
|
endif
|
|
|
|
ifeq (,${findstring $(newlib_source)/libc/sys/cygwin/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
|
|
|
|
newlib_sys_include_include:=-I$(newlib_source)/libc/sys/cygwin/include
|
2001-10-10 03:57:43 +02:00
|
|
|
endif
|
|
|
|
ifeq (,${findstring $(cygwin_source)/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
|
|
|
|
cygwin_include:=-I$(cygwin_source)/include
|
|
|
|
endif
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-10-12 14:52:05 +02:00
|
|
|
INCLUDES:=-I. $(cygwin_include) -I$(cygwin_source) $(newlib_sys_include) $(newlib_include) $(newlib_sys_include_include) $(w32api_include)
|
2000-02-17 20:38:33 +01:00
|
|
|
ifdef CONFIG_DIR
|
|
|
|
INCLUDES+=-I$(CONFIG_DIR)
|
|
|
|
endif
|
|
|
|
|
2002-07-07 02:42:09 +02:00
|
|
|
MINGW_INCLUDES:=-I$(updir)/mingw/include $(w32api_include)
|
|
|
|
MINGW_CFLAGS:=-mno-cygwin $(MINGW_INCLUDES)
|
|
|
|
MINGW_CXXFLAGS:=${filter-out $(newlib_source)/%,$(CXXFLAGS)} -mno-cygwin $(MINGW_INCLUDES)
|
2003-01-22 18:10:02 +01:00
|
|
|
MINGW_LDFLAGS:=-B${mingw_build} -B${mingw_build}/mingwex
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
GCC_DEFAULT_OPTIONS:=$(CFLAGS_COMMON) $(CFLAGS_CONFIG) $(INCLUDES)
|
|
|
|
|
|
|
|
# Link in libc and libm from newlib
|
|
|
|
|
|
|
|
LIBC:=$(newlib_build)/libc/libc.a
|
|
|
|
LIBM:=$(newlib_build)/libm/libm.a
|
|
|
|
CRT0:=$(newlib_build)/libc/crt0.o
|
|
|
|
|
|
|
|
ALL_CFLAGS:=$(DEFS) $(MALLOC_DEBUG) $(CFLAGS) $(GCC_DEFAULT_OPTIONS)
|
2003-03-29 05:15:52 +01:00
|
|
|
ALL_CXXFLAGS=$(DEFS) $(MALLOC_DEBUG) $(CXXFLAGS) $(GCC_DEFAULT_OPTIONS)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
ifndef PREPROCESS
|
|
|
|
c=-c
|
|
|
|
o=.o
|
|
|
|
else
|
|
|
|
c=-E
|
|
|
|
o=.E
|
|
|
|
endif
|
|
|
|
|
2000-12-03 06:40:45 +01:00
|
|
|
libgcc:=${subst \,/,${shell $(CC_FOR_TARGET) -print-libgcc-file-name}}
|
2001-10-10 03:57:43 +02:00
|
|
|
gcc_libdir:=${word 1,${dir $(libgcc)}}
|
|
|
|
ifeq (,${findstring $(gcc_libdir),$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
|
2003-03-09 20:22:15 +01:00
|
|
|
GCC_INCLUDE:=${subst //,/,-I$(gcc_libdir)/include}
|
2001-10-10 03:57:43 +02:00
|
|
|
endif
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2003-03-17 23:35:53 +01:00
|
|
|
nostdinc:=${shell [ -d "$(updir)/w32api" ] && echo "-nostdinc -nostdinc++"}
|
2003-03-18 00:13:26 +01:00
|
|
|
ifeq (,$(nostdinc))
|
|
|
|
override w32api_lib:=${subst //,/,${shell $(CC) -print-search-dirs | awk -F: '/^librar/{for (i = 1; i <= NF; i++) if ($$i ~ /\/lib\/*$$/) print $$i}'}/w32api}
|
|
|
|
endif
|
2003-03-17 23:27:07 +01:00
|
|
|
|
|
|
|
COMPILE_CXX=$(CXX) $c $(nostdinc) $(ALL_CXXFLAGS) $(GCC_INCLUDE) \
|
2001-02-22 13:37:32 +01:00
|
|
|
-fno-rtti -fno-exceptions
|
2003-03-17 23:27:07 +01:00
|
|
|
COMPILE_CC=$(CC) $c $(nostdinc) $(ALL_CFLAGS) $(GCC_INCLUDE)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
vpath %.a $(cygwin_build):$(w32api_lib):$(newlib_build)/libc:$(newlib_build)/libm
|
|
|
|
|
2000-04-09 08:15:43 +02:00
|
|
|
MAKEOVERRIDES_WORKAROUND=${wordlist 2,1,a b c}
|
|
|
|
|
|
|
|
ifneq ($(MAKEOVERRIDES_WORKAROUND),)
|
|
|
|
override MAKE:=$(MAKE) $(MAKEOVERRIDES)
|
|
|
|
MAKEOVERRIDES:=
|
|
|
|
export MAKEOVERRIDES
|
|
|
|
endif
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2000-10-01 06:32:36 +02:00
|
|
|
ifdef RPATH_ENVVAR
|
|
|
|
VERBOSE=1
|
|
|
|
endif
|
|
|
|
|
2000-10-02 04:05:23 +02:00
|
|
|
ifneq "${findstring -B,$(COMPILE_CXX) $(COMPILE_CC)}" ""
|
|
|
|
VERBOSE=1
|
|
|
|
endif
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
.PRECIOUS: %.o
|
|
|
|
|
|
|
|
%.o: %.cc
|
|
|
|
ifdef VERBOSE
|
|
|
|
$(COMPILE_CXX) -o $(@D)/$(*F)$o $<
|
|
|
|
else
|
2000-12-03 06:40:45 +01:00
|
|
|
@echo $(CXX) $c $(CXXFLAGS) ... $(*F).cc
|
2000-05-24 20:54:10 +02:00
|
|
|
@$(COMPILE_CXX) -o $(@D)/$(*F)$o $<
|
2000-02-17 20:38:33 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
ifdef VERBOSE
|
|
|
|
$(COMPILE_CC) -o $(@D)/$(*F)$o $<
|
|
|
|
else
|
2000-05-24 20:54:10 +02:00
|
|
|
@echo $(CC) $c $(CFLAGS) ... $(*F).c
|
|
|
|
@$(COMPILE_CC) -o $(@D)/$(*F)$o $<
|
2000-02-17 20:38:33 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
$(bupdir1)/libiberty/%.o: $(updir1)/libiberty/%.c
|
2000-04-10 05:51:39 +02:00
|
|
|
@$(MAKE) -C $(@D) $(@F)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
|
|
|
$(w32api_lib)/%.a: $(w32api_lib)/Makefile
|
2000-04-10 05:51:39 +02:00
|
|
|
@$(MAKE) --no-print-dir -C $(@D) $(@F)
|
2000-02-17 20:38:33 +01:00
|
|
|
|
2001-12-14 19:26:43 +01:00
|
|
|
$(bz2lib)/%.a: $(bz2lib)/Makefile
|
2001-12-14 19:23:19 +01:00
|
|
|
@$(MAKE) --no-print-dir -C $(@D) $(@F)
|
|
|
|
|
2001-12-14 19:26:43 +01:00
|
|
|
$(zlib)/%.a: $(zlib)/Makefile
|
2001-12-14 19:23:19 +01:00
|
|
|
@$(MAKE) --no-print-dir -C $(@D) $(@F)
|
|
|
|
|
2000-02-17 20:38:33 +01:00
|
|
|
all:
|
|
|
|
|
|
|
|
# For auto-rebuilding the Makefile
|
|
|
|
|
|
|
|
.PRECIOUS: Makefile
|
|
|
|
|
|
|
|
Makefile: Makefile.in $(srcdir)/configure.in config.status
|
|
|
|
$(SHELL) config.status
|
|
|
|
|
|
|
|
config.status: configure
|
|
|
|
$(SHELL) config.status --recheck
|