changed AR args for WIN32
This commit is contained in:
@@ -4,20 +4,7 @@
|
||||
# needs
|
||||
# * gnumake (OK, sources for WIN32 are available)
|
||||
# * Perl (e.g. from www.perl.com )
|
||||
# * a UNIX-like shell (ouch!)
|
||||
#
|
||||
# I found no fully operational shell and no sources for WIN32 so far,
|
||||
# Cygnus' bash e.g. cannot handle this:
|
||||
# (echo a>a; echo b>>a)
|
||||
# Right now I use the knts that I wrote and simplified scripts.
|
||||
# Jeff eliminated many shell-lines in Makefile.*.
|
||||
#
|
||||
|
||||
# Set this to the UNIX-like shell that you have:
|
||||
#
|
||||
# it is now possible to just use the DOS shell
|
||||
#
|
||||
#SHELL=knts
|
||||
|
||||
# Use std path variables from ms
|
||||
HOME = $(HOMEDRIVE)$(HOMEPATH)
|
||||
@@ -34,13 +21,16 @@ BUILD_TYPE=Host
|
||||
HOST_OPT = YES
|
||||
|
||||
# -Ox : maximum optimizations
|
||||
# -Wn ; use this warning level (all warnings at level 4)
|
||||
CXX_OPT_FLAGS_YES = -Ox -W3
|
||||
# -Wn : use this warning level (all warnings at level 4)
|
||||
# -MD : use MSVCRT (run-time as DLL, multi-thread support)
|
||||
CXX_OPT_FLAGS_YES = -Ox -W3 -MD
|
||||
# -Zi : include debugging info in object files
|
||||
CXX_OPT_FLAGS_NO = -Zi -W3 -D_DEBUG
|
||||
# -MDd : use MSVCRTD (debug, multi-thread support)
|
||||
CXX_OPT_FLAGS_NO = -Zi -W3 -MDd
|
||||
CXX_OPT_FLAGS = $(CXX_OPT_FLAGS_$(HOST_OPT))
|
||||
|
||||
LINK_OPT_FLAGS_YES =
|
||||
LINK_OPT_FLAGS_NO = -debug
|
||||
LINK_OPT_FLAGS_NO = -debug
|
||||
LINK_OPT_FLAGS = $(LINK_OPT_FLAGS_$(HOST_OPT))
|
||||
|
||||
|
||||
@@ -59,14 +49,17 @@ WIN32=1
|
||||
YACC = $(EYACC)
|
||||
LEX = $(ELEX)
|
||||
CC = cl -nologo
|
||||
CXX = cl -nologo
|
||||
ARCMD = lib -nologo -verbose -out:$@
|
||||
CP = $(PERL) $(INSTALL_BIN)/cp.pl
|
||||
MV = $(PERL) $(INSTALL_BIN)/mv.pl
|
||||
RM = $(PERL) $(INSTALL_BIN)/rm.pl -f
|
||||
MKDIR = $(PERL) $(INSTALL_BIN)/mkdir.pl
|
||||
RMDIR = $(PERL) $(INSTALL_BIN)/rm.pl -rf
|
||||
ECHO = echo
|
||||
|
||||
EXE=.exe
|
||||
OBJ=.obj
|
||||
ECHO = echo
|
||||
|
||||
# Include files
|
||||
HOST_INCLUDES = -I. -I.. $(USR_INCLUDES) -I$(INSTALL_INCLUDE) \
|
||||
@@ -79,15 +72,10 @@ HOST_INCLUDES = -I. -I.. $(USR_INCLUDES) -I$(INSTALL_INCLUDE) \
|
||||
# 2) set it to 0 to use MS C "extensions" (open for _open etc.)
|
||||
# because MS uses: if __STDC__ ... disable many nice things
|
||||
#
|
||||
# -MDd : use MSVCRTD (run-time as DLL, multi-thread support)
|
||||
# this also calls for _DLL
|
||||
#
|
||||
# Unable to use -Za to turn on __STDC__ because there are
|
||||
# non-standard constructs in winnt.h etc
|
||||
#
|
||||
OP_SYS_FLAGS = -MDd -VMG -VMV -DWIN32 -D_WIN32 -D_WINDOWS \
|
||||
-D_X86_ -D_NTSDK -D_DLL -D__STDC__=0
|
||||
|
||||
OP_SYS_FLAGS = -D__STDC__=0
|
||||
|
||||
HOST_LDLIBS = user32.lib kernel32.lib wsock32.lib advapi32.lib winmm.lib
|
||||
HOST_LDFLAGS = -nologo
|
||||
@@ -101,10 +89,9 @@ DLLENTRY = @12
|
||||
|
||||
# yes, for MS it's I386 for 386, 486, Pentium!
|
||||
# don't mix this with VxWorks which has different BSPs for [34]86 !
|
||||
WIN32_DLLFLAGS = $(HOST_LDFLAGS) $(HOST_LDLIBS)\
|
||||
WIN32_DLLFLAGS = $(HOST_LDFLAGS) \
|
||||
-subsystem:windows -dll -incremental:no $(LINK_OPT_FLAGS) -machine:I386
|
||||
|
||||
|
||||
ARCH_DEP_CFLAGS =
|
||||
ARCH_DEP_CXXFLAGS = $(ARCH_DEP_CFLAGS)
|
||||
HOST_CFLAGS = $(HOST_SFLAGS) $(HOST_INCLUDES) $(OP_SYS_FLAGS) $(CXX_OPT_FLAGS)
|
||||
@@ -123,10 +110,9 @@ CFLAGS = $(HOST_OPT_FLAGS) $(TARGET_CFLAGS) $(USR_CFLAGS) $(ARCH_DEP_CFLAGS) $(H
|
||||
CXXFLAGS = $(HOST_OPT_FLAGS) $(TARGET_CXXFLAGS) $(USR_CXXFLAGS) $(ARCH_DEP_CXXFLAGS) $(HOST_CXXFLAGS)
|
||||
CPPFLAGS += $(TARGET_CPPFLAGS) $(USR_CPPFLAGS)
|
||||
|
||||
CXX=cl -nologo
|
||||
|
||||
LDFLAGS=$(SPECIAL_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(ARCH_DEP_LDFLAGS) $(HOST_LDFLAGS)
|
||||
LDLIBS=$(TARGET_LDLIBS) $(USR_LDLIBS) $(ARCH_DEP_LDLIBS) $(HOST_LDLIBS)
|
||||
LDFLAGS = $(SPECIAL_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(ARCH_DEP_LDFLAGS) $(HOST_LDFLAGS)
|
||||
LDLIBS = $(TARGET_LDLIBS) $(USR_LDLIBS) $(ARCH_DEP_LDLIBS) $(HOST_LDLIBS)
|
||||
DLL_LDLIBS = $(DLL_DEP_LIBS) $(ARCH_DEP_LDLIBS) $(HOST_LDLIBS)
|
||||
|
||||
# Override SUN defaults
|
||||
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
|
||||
@@ -136,11 +122,52 @@ COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
|
||||
# i.e. -Tp has to be immediately before the source file name
|
||||
COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -Tp
|
||||
|
||||
LINK.c=link $(LINK_OPT_FLAGS) $(LDFLAGS) -out:$@
|
||||
LINK.cc=$(LINK.c)
|
||||
LINK.c = link $(LINK_OPT_FLAGS) $(LDFLAGS) -out:$@
|
||||
LINK.cc = $(LINK.c)
|
||||
|
||||
|
||||
#
|
||||
# specify dll .def file only if it exists
|
||||
#
|
||||
DLL_DEF_FLAG = $(addprefix -def:,$(wildcard ../$(LIBRARY).def))
|
||||
|
||||
# HOST_OPT_FLAGS is part of CFLAGS/CXXFLAGS,
|
||||
# which in turn are used in COMPILE.c[c]
|
||||
#
|
||||
# If we compile a .c, .cc into an $(OBJ),
|
||||
# we test if this object is part of the
|
||||
# library objects LIBOBJS.
|
||||
# If so, we define _WINDLL so that
|
||||
# e.g. include/shareLib.h works correctly.
|
||||
#
|
||||
HOST_OPT_FLAGS += $(subst $@, -D_WINDLL, $(findstring $@,$(LIBOBJS)))
|
||||
|
||||
#
|
||||
# A WIN32 dll has three parts:
|
||||
# x.dll: the real dll (DLLNAME)
|
||||
# x.lib: what you link to progs that use the dll (LIBNAME)
|
||||
# x.exp: what you need to build the dll (in no variable)
|
||||
#
|
||||
LINK.dll = link $(WIN32_DLLFLAGS) -implib:$(@:%.dll=%.lib) -out:$@ $(DLL_DEF_FLAG)
|
||||
|
||||
# The DEPENDS_RULE may be a script on other systems,
|
||||
# if you need different rules for .c and .cc,
|
||||
# that script has to figure out what to call.
|
||||
#
|
||||
DEPENDS_RULE = @echo no DEPENDS_RULE defined in CONFIG.WIN32
|
||||
|
||||
# adjust names of libraries to build
|
||||
#
|
||||
# But: if there are no objects LIBOBJS to include
|
||||
# in this library (may be for e.g. base/src/libCompat
|
||||
# on some archs), don't define (and build) any library!
|
||||
DLLNAME = $(LIBRARY).dll
|
||||
# libs defined that we need to link the DLL with
|
||||
DLL_DEP_LIBS = $(DLL_LIBS:%=$(INSTALL_LIB)/%.lib)
|
||||
|
||||
LIBNAME = $(LIBRARY).lib
|
||||
PRODDEPLIBS = $(PROD_LIBS:%=$(INSTALL_LIB)/%.lib)
|
||||
USR_LDLIBS += $(PRODDEPLIBS)
|
||||
SYSPRODDEPLIBS = # ???????? unimplemented dependency
|
||||
USR_LDLIBS += $(SYSPRODDEPLIBS)
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
|
||||
#
|
||||
# no longer required
|
||||
#
|
||||
#SHELL=knts
|
||||
|
||||
# Use std path variables from ms
|
||||
HOME = $(HOMEDRIVE)$(HOMEPATH)
|
||||
|
||||
# BUILD_TYPE
|
||||
# Currently either Vx or Unix
|
||||
|
||||
@@ -44,9 +44,9 @@ vpath %.h $(USER_VPATH)
|
||||
# this one is appended
|
||||
# 4) if you have the special case that your USR_CFLAGS_$(ARCH_CLASS) is
|
||||
# empty but you don't want 3), you have to define it as '-nil-', e.g.:
|
||||
# USR_CFLAGS := <defines for all systems>
|
||||
# USR_CFLAGS_sun4 := -nil-
|
||||
# USR_CFLAGS_DEFAULT := <defines for most systems, not sun4>
|
||||
# USR_CFLAGS = <defines for all systems>
|
||||
# USR_CFLAGS_sun4 = -nil-
|
||||
# USR_CFLAGS_DEFAULT = <defines for most systems, not sun4>
|
||||
#
|
||||
# These rules apply to these Makefile-variables:
|
||||
# USR_CFLAGS C flags
|
||||
@@ -59,11 +59,11 @@ vpath %.h $(USER_VPATH)
|
||||
# SCRIPTS scripts to install
|
||||
#
|
||||
# Remark:
|
||||
# If you define a special INC, e.g. INC_WIN32 := getopt.h,
|
||||
# If you define a special INC, e.g. INC_WIN32 = getopt.h,
|
||||
# the source (getopt.h) has to be in os/WIN32 (or os/<your ARCH_CLASS>)
|
||||
#
|
||||
# This makes INC_$(ARCH_CLASS) slightly different from OSINC:
|
||||
# OSINC := a_file.h
|
||||
# OSINC = a_file.h
|
||||
# means that you have a special os/$(ARCH_CLASS)/a_file.h
|
||||
# for _every_ ARCH_CLASS.
|
||||
# If you use INC_$(ARCH_CLASS), you need the special include
|
||||
@@ -170,73 +170,6 @@ endif
|
||||
|
||||
endif
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# adjust names to platform specific pre-/postfixes,
|
||||
# this is ugly (ifdef XXX...) but hopefully get's you there...
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
# adjust names of libraries to build
|
||||
#
|
||||
# But: if there are no objects LIBOBJS to include
|
||||
# in this library (may be for e.g. base/src/libCompat
|
||||
# on some archs), don't define (and build) any library!
|
||||
ifdef LIBRARY
|
||||
ifdef LIBOBJS
|
||||
|
||||
ifndef WIN32
|
||||
# handle plain Unix first because it's easy: <lib> -> lib<lib>.a
|
||||
LIBNAME:=$(LIBRARY:%=lib%.a)
|
||||
|
||||
else
|
||||
# WIN32 library name:
|
||||
LIBNAME:=$(LIBRARY).lib
|
||||
# check if DLL or plain lib requested:
|
||||
ifeq ($(LIBTYPE),SHARED)
|
||||
# create name for dll, import file
|
||||
DLLNAME:=$(LIBRARY).dll
|
||||
# libs defined that we need to link the DLL with?
|
||||
DLL_DEP_LIBS:=$(DLL_LIBS:%=$(INSTALL_LIB)/%.lib)
|
||||
endif # LIBTYPE=SHARED
|
||||
endif # WIN32
|
||||
|
||||
endif
|
||||
endif # LIBRARY and LIBOBJS
|
||||
|
||||
# dito for libraries used by PROD
|
||||
#
|
||||
ifdef PROD_LIBS
|
||||
# add to USR_LDLIBS so that the libs are linked
|
||||
|
||||
ifdef WIN32
|
||||
PRODDEPLIBS:=$(PROD_LIBS:%=$(INSTALL_LIB)/%.lib)
|
||||
USR_LDLIBS += $(PROD_LIBS:%=$(INSTALL_LIB)/%.lib)
|
||||
else
|
||||
# On Unix: library "ca" is linked with "-lca" etc.
|
||||
PRODDEPLIBS=$(PROD_LIBS:%=$(INSTALL_LIB)/lib%.a)
|
||||
USR_LDLIBS += -L$(INSTALL_LIB) $(PROD_LIBS:%=-l%)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
# dito for system libraries used by PROD
|
||||
#
|
||||
ifdef SYS_PROD_LIBS
|
||||
|
||||
ifdef WIN32
|
||||
# add to USR_LDLIBS so that the libs are linked
|
||||
USR_LDLIBS += $(SYSPRODDEPLIBS)
|
||||
else
|
||||
# On Unix: it is difficult to determine where the
|
||||
# system lib is (because of add on compilere).
|
||||
# Therefore no additions to PRODDEPLIBS for
|
||||
# system libraries.
|
||||
#
|
||||
USR_LDLIBS += $(SYS_PROD_LIBS:%=-l%)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
# adjust executables
|
||||
ifdef PROD
|
||||
PROD := $(addsuffix $(EXE), $(PROD))
|
||||
@@ -290,15 +223,33 @@ ifdef TEMPLATES_DIR
|
||||
DIRECTORY_TARGETS += $(INSTALL_TEMPLATES)/$(TEMPLATES_DIR)
|
||||
endif
|
||||
|
||||
# if there are no objects LIBOBJS to include
|
||||
# in this library (may be for e.g. base/src/libCompat
|
||||
# on some archs), don't define (and build) any library!
|
||||
ifdef LIBRARY
|
||||
ifdef LIBOBJS
|
||||
LIBTARGETS = $(INSTALL_LOCATION_LIB) $(INSTALL_LIB)
|
||||
# check if DLL or plain lib requested:
|
||||
ifeq ($(LIBTYPE),SHARED)
|
||||
#
|
||||
# LIBTYPE=="SHARED" indicates build
|
||||
# DLL and also build object archive library
|
||||
#
|
||||
LIBTARGETS += $(DLLNAME) $(INSTALL_DLLS) $(LIBNAME) $(INSTALL_LIBS)
|
||||
else # LIBTYPE=SHARED
|
||||
#
|
||||
# otherwise build only object archive library
|
||||
#
|
||||
LIBTARGETS += $(LIBNAME) $(INSTALL_LIBS)
|
||||
endif # LIBTYPE=SHARED
|
||||
endif # LIBOBJS
|
||||
endif # LIBRARY
|
||||
|
||||
# Main target
|
||||
#
|
||||
all:: install
|
||||
|
||||
build:: $(LIBNAME) $(DLLNAME) \
|
||||
$(INSTALL_LOCATION_LIB) $(INSTALL_LIB)\
|
||||
$(INSTALL_LIBS) $(INSTALL_DLLS) $(PROD) $(TESTPROD)
|
||||
|
||||
build:: $(LIBTARGETS) $(PROD) $(TESTPROD)
|
||||
|
||||
inc:: $(INSTALL_INCLUDE) $(INSTALL_INC) \
|
||||
$(INSTALL_INCLUDE)/os $(INSTALL_OSINCLUDE) $(INSTALL_OSINC)
|
||||
@@ -467,64 +418,19 @@ endif
|
||||
$(MANGEN) -s $<
|
||||
$(MV) $(<F).nr $(<F).1
|
||||
|
||||
# Rules for building LIBRARY with LIBSRCS
|
||||
# (which are now LIBNAME, LIBOBJS)
|
||||
#
|
||||
ifdef WIN32
|
||||
|
||||
ifeq ($(LIBTYPE),SHARED)
|
||||
# A WIN32 dll has tree parts:
|
||||
# x.dll: the real dll (DLLNAME)
|
||||
# x.lib: what you link to progs that use the dll (LIBNAME)
|
||||
# x.exp: what you need to build the dll (in no variable)
|
||||
#
|
||||
# the latter two are created automatically when building the dll:
|
||||
$(LIBNAME): $(DLLNAME)
|
||||
|
||||
# test if there is a def file for this dll:
|
||||
#
|
||||
DLL_DEF_FILE := ../$(LIBRARY).def
|
||||
|
||||
ifeq ($(DLL_DEF_FILE), $(wildcard $(DLL_DEF_FILE)))
|
||||
DLL_DEF := -def:$(DLL_DEF_FILE)
|
||||
endif
|
||||
|
||||
# HOST_OPT_FLAGS is part of CFLAGS/CXXFLAGS,
|
||||
# which in turn are used in COMPILE.c[c]
|
||||
#
|
||||
# If we compile a .c, .cc into an $(OBJ),
|
||||
# we test if this object is part of the
|
||||
# library objects LIBOBJS.
|
||||
# If so, we define _WINDLL so that
|
||||
# e.g. include/shareLib.h works correctly.
|
||||
#
|
||||
HOST_OPT_FLAGS += $(subst $@, -D_WINDLL, $(findstring $@,$(LIBOBJS)))
|
||||
|
||||
# rule for shareable (DLL- dynamic link library) creation
|
||||
$(DLLNAME): $(LIBOBJS)
|
||||
link $(WIN32_DLLFLAGS)\
|
||||
-implib:$(LIBNAME) -out:$(DLLNAME) $(DLL_DEF)\
|
||||
$(DLL_DEP_LIBS) $(ARCH_DEP_LDLIBS) $(HOST_LDLIBS) $(LIBOBJS)
|
||||
else
|
||||
# still on WIN32, this time no DLL but plain lib requested:
|
||||
$(LIBNAME): $(LIBOBJS)
|
||||
lib -nologo -verbose -out:$(LIBNAME) $(LIBOBJS)
|
||||
lib -nologo -list $(LIBNAME)
|
||||
$(LINK.dll) $(LIBOBJS) $(DLL_LDLIBS)
|
||||
|
||||
endif # LIBTYPE is SHARED ?
|
||||
|
||||
else # not WIN32
|
||||
|
||||
# usual Unix rule for lib creation
|
||||
# rule for lib (archive of object files) creation
|
||||
$(LIBNAME): $(LIBOBJS)
|
||||
$(RM) $@
|
||||
$(ARCMD) $@ $(LIBOBJS)
|
||||
@if [ ! -z "$(RANLIB)" ] ; then\
|
||||
echo $(RANLIB) $@; \
|
||||
$(RANLIB) $@; \
|
||||
fi
|
||||
endif # ifdef WIN32
|
||||
# end of library creation rules
|
||||
|
||||
$(ARCMD) $(LIBOBJS)
|
||||
ifdef RANLIB
|
||||
ifeq ($(RANLIB), $(wildcard $(RANLIB)))
|
||||
$(RANLIB) $@;
|
||||
endif # RANLIB image exists
|
||||
endif # RANLIB
|
||||
|
||||
$(INSTALL_BIN)/%: ../os/$(ARCH_CLASS)/%
|
||||
@echo "Installing os-specific script $@"
|
||||
|
||||
@@ -156,7 +156,7 @@ $(TARGETS) $(PROD): $(DEPLIBS)
|
||||
$(LIBNAME): $(LIBOBJS)
|
||||
@echo Building library $@
|
||||
$(RM) $@
|
||||
$(ARCMD) $@ $(LIBOBJS)
|
||||
$(ARCMD) $(LIBOBJS)
|
||||
@if [ ! -z "$(RANLIB)" ] ; then\
|
||||
echo $(RANLIB) $@; \
|
||||
$(RANLIB) $@; \
|
||||
|
||||
Reference in New Issue
Block a user