Page 2 of 2

Re: Ayuda..... NMAKE II

PostPosted: Fri Feb 22, 2013 7:21 pm
by Antonio Linares
Lucas,

Como te he comentado por chat, nosotros usamos el make de Borland para construir nuestras librerias. En el caso de FiveWeb usamos win-make.exe que es libre.

Asi que sentimos no poder ayudarte en eso. Tendrás que hacer pruebas y buscar información y ejemplos en internet. Es lo mismo que tendría que hacer yo :-) pues nmake,exe es una herramienta de Microsoft no nuestra.

Re: Ayuda..... NMAKE II

PostPosted: Fri Feb 22, 2013 7:36 pm
by lucasdebeltran
Antonio,

Muchas gracias, con win-make tampoco me funciona.

Me dice makefile_win18: *** multiple target patters. Stop

Este es el make:

Code: Select all  Expand view
# FiveWeb makefile

HBDIR=c:\harbourmsvc2010
FWDIR=c:\fwh
VCDIR="c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"
SDKDIR="c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A"

all : .\lib\fiveweb.lib

PRG_OBJS = ./obj/one.obj \
    ./obj/two.obj \
    ./obj/three.obj \
    ./obj/myc.obj

.\lib\fiveweb.lib : $(PRG_OBJS)

./obj/%.obj : ./obj/%.c
        cl.exe -c -TP -W3 -I$(HBDIR)\include -I$(SDKDIR)\include -I$(VCDIR)\include $<
    $(VCDIR)\bin\lib test.lib /OUT:test.lib one.obj two.obj three.obj myc.obj

./obj/%.c : ./source/%.prg
    c:\harbourmsvc2010\bin\harbour\bin\harbour $< -o.\$@ -n -Ic:\c:\harbourmsvc2010\include -I.\include

./obj/%.c : ./source/%.prg
    c:\harbourmsvc2010\bin\harbour\bin\harbour $< -o.\$@ -n -Ic:\c:\harbourmsvc2010\include -I.\include
 



Muchas gracias. A mi el make me da igual, lo que tengo es que compilar con msvc y tener subdirectorios para source, obj y lib.

A ver si lo conseguimos.

Re: Ayuda..... NMAKE II

PostPosted: Fri Feb 22, 2013 8:53 pm
by Daniel Garcia-Gil
Hola

aqui te dejo un ejemplo de como crear la lib

estructura del directorio

Code: Select all  Expand view
raiz
  |->goclean.bat (limpia directorios y builds)
  |->golib.bat (construye la lib desde los fuentes)
  |->makefile (archivo del make)
  |->win-make.exe (mismo ejecutable que proporciona harbour para use archivos make)
  |->lib (directorio donde se creara la lib)
  |->source
       |->c (directorio que contiene archivos .c)
       |->cpp (directorio que contiene archivos .cpp)
       |->prg (directorio que contiene archivos .prg)


edita makefile y proporciona nombre de la lib (LIBNAME) y arregla los path segun tu conveniencia, la variable "SRC_FILES_PRG" se le asigna los nombres de los PRG (separados por espacios) sin la extencion, igual para las variables "SRC_FILES_C" y "SRC_FILES_CPP"

puedes decargarlo de aqui http://sitasoft.net/fivewin/files/makesvc.zip

dejo aqui los fuentes makefile, golib y goclean

makefile
Code: Select all  Expand view

#delcare user variables
USER_DEFINE=
LIBNAME=test
#
PRG_SOURCE_PATH=.\source\prg
C_SOURCE_PATH=.\source\c
CPP_SOURCE_PATH=.\source\cpp
OBJ_PATH=.\obj
HBDIR=c:\hb30
HBLIB=$(HBDIR)\lib\win\msvc
FWDIR=c:\fwh
FWINC=$(FWDIR)\include
CC=cl
LD=link
AR=lib
LIB_FLAGS= /OUT:lib\$(LIBNAME).lib $(filter %.obj,$^)
CC_FLAGS=-nologo -c -TP -W3 -GA -I$(HBDIR)\include -I.\include -I$(VCDIR)\include

#should use tabs to indent lines
#we dont need extention
SRC_FILES_PRG=one two three
SRC_FILES_C=myc
SRC_FILES_CPP=

OBJ_FILES = $(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_PRG))))\
                        $(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_C))))\
                        $(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_CPP))))

PRG_COMP_CMD=$(HBDIR)\bin\harbour $< /q0 /n /W /O$(OBJ_PATH)\ /I$(HBDIR)\include;.\include;$(FWINC) $(USER_DEFINE)
MSVC_LIB_DEF=$(AR) /DEF:lib\$(LIBNAME).def  /OUT:lib\$(LIBNAME).lib
LIB_CMD=$(AR) $(LIB_FLAGS)

define HAR_CMD
    @echo $(PRG_COMP_CMD) $< >> make.log
    @$(PRG_COMP_CMD) >> make.log
endef

define LIB_CMD1
    @$(MSVC_LIB_DEF) >> make.log
    @$(LIB_CMD)  >> make.log   
    @echo. >> make.log
endef

.PHONY: lib clean

lib : logfile builddef $(LIBNAME)

#is extremely necessary ident with tab inside targer-pattern
#should use tabs to indent lines
logfile:
    @echo. > make.log
    @echo # ----------------------------------------------------------------------- >> make.log
    @echo # Building $(LIBNAME)                                                     >> make.log
    @echo # ----------------------------------------------------------------------- >> make.log
    $(info ----------------------------------------------------------------------- )
    $(info Building $(LIBNAME)                                                     )
    $(info ----------------------------------------------------------------------- )

$(LIBNAME): $(OBJ_FILES)
    $(info Linking $(LIBNAME) )
    @$(LIB_CMD1)
    @echo $(LIB_CMD) >> make.log

$(OBJ_PATH)%.c: $(PRG_SOURCE_PATH)%.prg
    $(info Compiling $< )
    @$(HAR_CMD)

$(OBJ_PATH)%.c: $(PRG_SOURCE_PATH)%.PRG
    $(info Compiling $< )
    @$(HAR_CMD) 

$(OBJ_PATH)%.obj: $(OBJ_PATH)%.c
    @echo $(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
    @$(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
    @echo ========================================= >> make.log

$(OBJ_PATH)%.obj: $(C_SOURCE_PATH)%.c
    @echo $(CC) $(CC_FLAGS) -Fo$@ $<  >> make.log
    @$(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
    $(info Compiling $< )

$(OBJ_PATH)%.obj: $(CPP_SOURCE_PATH)%.cpp
    @echo $(CC) $(CC_FLAGS) -Fo$@ $<  >> make.log
   @$(CC) $(CC_FLAGS) -Fo$@ $<  >> make.log
   $(info Compiling $< )
   
builddef:
    @echo LIBRARY $(LIBNAME) > lib\$(LIBNAME).def
    @echo. >> lib\$(LIBNAME).def
    @echo EXPORTS >> lib\$(LIBNAME).def
    @echo. >> lib\$(LIBNAME).def
    @echo            dummy      @1 >> lib\$(LIBNAME).def

clean:
    @if EXIST obj\*.* del /F /Q obj\*.*
    @if EXIST lib\*.* del /F /Q lib\*.*
    @if EXIST *.bak del /F /Q *.bak
    @if EXIST *.log del /F /Q *.log
 


golib.bat

Code: Select all  Expand view

@echo off
@rem use %ProgramFiles(x86)% or %ProgramFiles%
@SET PROGRAMFILE=%ProgramFiles%
@SET OLD_PATH=%PATH%
@SET CC_COMP="%PROGRAMFILE%\Microsoft Visual Studio 10.0\vc"
@IF EXIST %CC_COMP%\vcvarsall.bat GOTO CALLVC ELSE GOTO NOFOUND

:READY
@if not exist obj md obj
@if not exist lib md lib
@CALL win-make
@GOTO FINISHED

:CALLVC
@call %CC_COMP%\vcvarsall.bat
@GOTO READY

:NOFOUND
@echo can not find %CC_COMP%\vcvarsall.bat
@GOTO FINISHED

:ERROR
@echo Error building app

:FINISHED
@SET PATH=%OLD_PATH%
 

Re: Ayuda..... NMAKE II

PostPosted: Sat Feb 23, 2013 10:09 am
by lucasdebeltran
Muchísimas gracias, Daniel.

Es justo lo que necesitaba. Funciona a las mil maravillas!!!.

Como siempre, mil gracias por tu ayuda.

Re: Ayuda..... NMAKE II

PostPosted: Sat Feb 23, 2013 1:22 pm
by Antonio Linares
Daniel,

muchas gracias :-)

Re: Ayuda..... NMAKE II

PostPosted: Sun Feb 24, 2013 2:04 am
by Daniel Garcia-Gil
aqui esta el make para una aplicacion

se agrega el directorio .\res donde estaran los RC alli mismo se colocara el RES generado

Code: Select all  Expand view

#delcare user variables
USER_DEFINE=
APPNAME=test
#
PRG_SOURCE_PATH=.\source\prg
C_SOURCE_PATH=.\source\c
CPP_SOURCE_PATH=.\source\cpp
OBJ_PATH=.\obj
RES_PATH=.\res
HBDIR=c:\hb30
HBLIB=$(HBDIR)\lib\win\msvc
FWDIR=c:\fwh
FWINC=$(FWDIR)\include
FWLIB=$(FWDIR)\lib
LD=link
CC=cl
LD_FLAGS=/NOLOGO /SUBSYSTEM:WINDOWS /FORCE:MULTIPLE /NODEFAULTLIB:libc /MACHINE:X86 /OUT:$(APPNAME).exe
CC_FLAGS=-nologo -c -TP -W3 -GA -I$(HBDIR)\include -I$(FWDIR)\include -I.\include -I$(VCDIR)\include
RC=rc

#should use tabs to indent lines
#we dont need extention
SRC_FILES_PRG=one two three
SRC_FILES_C=myc
SRC_FILES_CPP=
#resource
RC_FILES=one

#seting libs without extention and path
GUI_LIBS=fivehc32 fiveh32

HRB_LIB=hbrtl hbvmmt gtgui gtwin hblang hbmacro hbrdd rddntx rddcdx rddfpt hbsix hbdebug\
                hbcommon hbpp hbwin hbcpage hbct xhb hbpcre png hbzlib hbmzip hbziparc minizip

MSVC_LIB=kernel32 user32 gdi32 winspool comctl32 comdlg32 advapi32 shell32 ole32 oleaut32\
                    uuid odbc32 odbccp32 iphlpapi mpr version wsock32 psapi msimg32 libcmt oldnames libcpmt oledlg ws2_32 winmm
#user lib
#USER_LIBS=

#the libraries of msvc dont need this process
LIBS = $(addprefix $(FWLIB)\,$(addsuffix .lib,$(GUI_LIBS)))\
            $(addprefix $(HBLIB)\,$(addsuffix .lib,$(HRB_LIB)))\
            $(addsuffix .lib,$(MSVC_LIB))\
            $(USER_LIBS)

OBJ_FILES = $(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_PRG))))\
                        $(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_C))))\
                        $(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_CPP))))

RES_FILES = $(addprefix $(RES_PATH)\,$(notdir $(addsuffix .res,$(RC_FILES))))

LD_CMD=$(LD) $(OBJ_FILES) $(RES_FILES) $(LIBS) $(LD_FLAGS) > link.log
PRG_COMP_CMD=$(HBDIR)\bin\harbour $< /q0 /n /W /O$(OBJ_PATH)\ /i$(FWDIR)\include;$(HBDIR)\include;.\include $(USER_DEFINE)

define BUILD_APP
    @echo $(LD_CMD) >> make.log
    @$(LD_CMD)
endef

define HAR_CMD
    @echo $(PRG_COMP_CMD) $< >> make.log
    @$(PRG_COMP_CMD) >> make.log
endef

.PONNY: app clean

app : logfile $(APPNAME)

#is extremely necessary ident with tab inside targer-pattern
#should use tabs to indent lines
logfile:
    @echo. > make.log
    @echo # ----------------------------------------------------------------------- >> make.log
    @echo # Building $(APPNAME)                                                     >> make.log
    @echo # ----------------------------------------------------------------------- >> make.log
    $(info ----------------------------------------------------------------------- )
    $(info Building $(APPNAME)                                                     )
    $(info ----------------------------------------------------------------------- )


$(APPNAME): $(OBJ_FILES) $(RES_FILES)
    $(info Linking $(APPNAME) )
    @$(BUILD_APP)

$(OBJ_PATH)%.c: $(PRG_SOURCE_PATH)%.prg
    $(info Compiling $< )
    @$(HAR_CMD)

$(OBJ_PATH)%.obj: $(OBJ_PATH)%.c
    @echo $(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
    @$(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
    @echo ========================================= >> make.log

$(RES_PATH)%.res: $(RES_PATH)%.rc
    $(info Compiling $< )
    @echo $(RC) -r -d__FLAT__ $< >> make.log
    @$(RC) -r -d__FLAT__ $< >> make.log

$(OBJ_PATH)%.obj: $(C_SOURCE_PATH)%.c
    @echo $(CC) $(CC_FLAGS) -Fo$@ $<  >> make.log
    @$(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
    $(info Compiling $< )

$(OBJ_PATH)%.obj: $(CPP_SOURCE_PATH)%.cpp
    @echo $(CC) $(CC_FLAGS) -Fo$@ $<  >> make.log
    @$(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
    $(info Compiling $< )
   

clean:
    @if EXIST obj\*.* del /F /Q obj\*.*
    @if EXIST lib\*.* del /F /Q lib\*.*
    @if EXIST *.bak del /F /Q *.bak
    @if EXIST *.log del /F /Q *.log
    @if EXIST res\*.res del /F /Q res\*.res
   
 

Re: Ayuda..... NMAKE II

PostPosted: Sat Dec 07, 2019 11:09 pm
by Compuin
Daniel Garcia-Gil wrote:Hola

aqui te dejo un ejemplo de como crear la lib

estructura del directorio

Code: Select all  Expand view
raiz
  |->goclean.bat (limpia directorios y builds)
  |->golib.bat (construye la lib desde los fuentes)
  |->makefile (archivo del make)
  |->win-make.exe (mismo ejecutable que proporciona harbour para use archivos make)
  |->lib (directorio donde se creara la lib)
  |->source
       |->c (directorio que contiene archivos .c)
       |->cpp (directorio que contiene archivos .cpp)
       |->prg (directorio que contiene archivos .prg)


edita makefile y proporciona nombre de la lib (LIBNAME) y arregla los path segun tu conveniencia, la variable "SRC_FILES_PRG" se le asigna los nombres de los PRG (separados por espacios) sin la extencion, igual para las variables "SRC_FILES_C" y "SRC_FILES_CPP"

puedes decargarlo de aqui http://sitasoft.net/fivewin/files/makesvc.zip

dejo aqui los fuentes makefile, golib y goclean

makefile
Code: Select all  Expand view

#delcare user variables
USER_DEFINE=
LIBNAME=test
#
PRG_SOURCE_PATH=.\source\prg
C_SOURCE_PATH=.\source\c
CPP_SOURCE_PATH=.\source\cpp
OBJ_PATH=.\obj
HBDIR=c:\hb30
HBLIB=$(HBDIR)\lib\win\msvc
FWDIR=c:\fwh
FWINC=$(FWDIR)\include
CC=cl
LD=link
AR=lib
LIB_FLAGS= /OUT:lib\$(LIBNAME).lib $(filter %.obj,$^)
CC_FLAGS=-nologo -c -TP -W3 -GA -I$(HBDIR)\include -I.\include -I$(VCDIR)\include

#should use tabs to indent lines
#we dont need extention
SRC_FILES_PRG=one two three
SRC_FILES_C=myc
SRC_FILES_CPP=

OBJ_FILES = $(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_PRG))))\
                        $(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_C))))\
                        $(addprefix $(OBJ_PATH)\,$(notdir $(addsuffix .obj,$(SRC_FILES_CPP))))

PRG_COMP_CMD=$(HBDIR)\bin\harbour $< /q0 /n /W /O$(OBJ_PATH)\ /I$(HBDIR)\include;.\include;$(FWINC) $(USER_DEFINE)
MSVC_LIB_DEF=$(AR) /DEF:lib\$(LIBNAME).def  /OUT:lib\$(LIBNAME).lib
LIB_CMD=$(AR) $(LIB_FLAGS)

define HAR_CMD
    @echo $(PRG_COMP_CMD) $< >> make.log
    @$(PRG_COMP_CMD) >> make.log
endef

define LIB_CMD1
    @$(MSVC_LIB_DEF) >> make.log
    @$(LIB_CMD)  >> make.log   
    @echo. >> make.log
endef

.PHONY: lib clean

lib : logfile builddef $(LIBNAME)

#is extremely necessary ident with tab inside targer-pattern
#should use tabs to indent lines
logfile:
    @echo. > make.log
    @echo # ----------------------------------------------------------------------- >> make.log
    @echo # Building $(LIBNAME)                                                     >> make.log
    @echo # ----------------------------------------------------------------------- >> make.log
    $(info ----------------------------------------------------------------------- )
    $(info Building $(LIBNAME)                                                     )
    $(info ----------------------------------------------------------------------- )

$(LIBNAME): $(OBJ_FILES)
    $(info Linking $(LIBNAME) )
    @$(LIB_CMD1)
    @echo $(LIB_CMD) >> make.log

$(OBJ_PATH)%.c: $(PRG_SOURCE_PATH)%.prg
    $(info Compiling $< )
    @$(HAR_CMD)

$(OBJ_PATH)%.c: $(PRG_SOURCE_PATH)%.PRG
    $(info Compiling $< )
    @$(HAR_CMD) 

$(OBJ_PATH)%.obj: $(OBJ_PATH)%.c
    @echo $(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
    @$(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
    @echo ========================================= >> make.log

$(OBJ_PATH)%.obj: $(C_SOURCE_PATH)%.c
    @echo $(CC) $(CC_FLAGS) -Fo$@ $<  >> make.log
    @$(CC) $(CC_FLAGS) -Fo$@ $< >> make.log
    $(info Compiling $< )

$(OBJ_PATH)%.obj: $(CPP_SOURCE_PATH)%.cpp
    @echo $(CC) $(CC_FLAGS) -Fo$@ $<  >> make.log
   @$(CC) $(CC_FLAGS) -Fo$@ $<  >> make.log
   $(info Compiling $< )
   
builddef:
    @echo LIBRARY $(LIBNAME) > lib\$(LIBNAME).def
    @echo. >> lib\$(LIBNAME).def
    @echo EXPORTS >> lib\$(LIBNAME).def
    @echo. >> lib\$(LIBNAME).def
    @echo            dummy      @1 >> lib\$(LIBNAME).def

clean:
    @if EXIST obj\*.* del /F /Q obj\*.*
    @if EXIST lib\*.* del /F /Q lib\*.*
    @if EXIST *.bak del /F /Q *.bak
    @if EXIST *.log del /F /Q *.log
 


golib.bat

Code: Select all  Expand view

@echo off
@rem use %ProgramFiles(x86)% or %ProgramFiles%
@SET PROGRAMFILE=%ProgramFiles%
@SET OLD_PATH=%PATH%
@SET CC_COMP="%PROGRAMFILE%\Microsoft Visual Studio 10.0\vc"
@IF EXIST %CC_COMP%\vcvarsall.bat GOTO CALLVC ELSE GOTO NOFOUND

:READY
@if not exist obj md obj
@if not exist lib md lib
@CALL win-make
@GOTO FINISHED

:CALLVC
@call %CC_COMP%\vcvarsall.bat
@GOTO READY

:NOFOUND
@echo can not find %CC_COMP%\vcvarsall.bat
@GOTO FINISHED

:ERROR
@echo Error building app

:FINISHED
@SET PATH=%OLD_PATH%
 


Saludos,

Usando este Makefile estoy recibiendo este error...ya lo he revisado pero no logro resolverlo

Code: Select all  Expand view
makefile:62: *** commands commence before first target.  Stop.


Alguien ha tenido el mismo incidente?