#!/usr/bin/make
#
# Copyright (c) 2003 by Salvador E. Tropea.
# Covered by the GPL license.
#
# For MSVC. NOT TESTED PLEASE HELP ME TO FIX IT.
# This file contains the definitions needed to compile and link the rules
# found in .umk files.
# The definitions are used by all the makefiles.
#

#
# That configure the compilation and linking options.
# Is equivalent to rhide.env.
#
!include config.nmk

SRCDIRS_2=$(SRCDIRS);.
#.path.cc=$(SRCDIRS_2)
#.path.c=$(SRCDIRS_2)
#.path.s=$(SRCDIRS_2)

# Turn off the implicit rule to generate .obj files from .c files.
# If we don't do it make will use both rules.
.c.obj:

HELPER_TARGET=mlink.exe
# These files changes the compilation process so they are important
# dependencies.
#MAKEFILE_DEPS=$(HELPER_TARGET)
MAKEFILE_DEPS=
# Extensions used by Microsoft tools
ExOBJ=.obj
ExEXE=.exe
ExLIB=.lib

RHIDE_AR=lib
RHIDE_ARFLAGS=

# Is that correct? Why not with cl?
RHIDE_COMPILE_LINK=$(RHIDE_LD) $(LDFLAGS) /OUT:$(OUTFILE) $(OBJ_DIR) \
	$(LIBRARIES) $(RHIDE_LIBDIRS) user32.lib $(RHIDE_LIBS)
RHIDE_COMPILE_C=$(RHIDE_GCC) -c $(CFLAGS) $(INCLUDE_DIRS) -Fo$(OUTFILE) \
	$(SOURCE_NAME)
RHIDE_COMPILE_CC=$(RHIDE_GXX) -c $(CXXFLAGS) $(INCLUDE_DIRS) -Fo$(OUTFILE) \
	$(SOURCE_NAME)
RHIDE_COMPILE_ARCHIVE=$(RHIDE_AR) $(RHIDE_ARFLAGS) /OUT:$(OUTFILE) \
	$(ALL_PREREQ)
# This is fake, the .S files are used only for DJGPP and they are protected
# by preprocessor constructions. For this reason they can be used as C sources
# to generate dummy .obj files.
RHIDE_COMPILE_ASM_FORCE=$(RHIDE_GCC) -c $(CFLAGS) /TC $(INCLUDE_DIRS) -Fo$(OUTFILE) \
	$(SOURCE_NAME)

# Are these correct?
SOURCE_NAME=$**
OUTFILE=$@
ALL_PREREQ=$**

mlink.exe:: mlink.c
	$(RHIDE_GCC) kernel32.lib $(ALL_PREREQ) /link /OUT:$(OUTFILE)


