Makefile for FWH and MinGW gcc

Makefile for FWH and MinGW gcc

Postby Antonio Linares » Wed Sep 24, 2008 11:09 am

Here you have a first prototype of a Makefile for FWH and gcc.

Please notice that the "M" has to be uppercase. To build it just do: c:\mingw\bin\mingw32-make.exe. To easy it, we have created a make.bat file that just calls to c:\mingw\bin\mingw32-make.exe. Also notice that "left spaces" are "tabs" and not "spaces".

The plan is to build an EXE from one.prg, two.prg and three.c (the third one is a C file that we want to include in the EXE). We are not building the EXE from this Makefile yet. Just compiling all the PRGs and C modules.

Makefile
Code: Select all  Expand view
# gcc make example for Windows, developed by FiveTech Software

all : test.exe

PRG_OBJS = ./obj/one.c  \
                ./obj/two.c

C_OBJS = ./obj/one.o \
         ./obj/two.o \
         ./obj/three.o

test.exe : $(PRG_OBJS) $(C_OBJS)

./obj/%.c : %.prg
   if not exist obj mkdir obj
   c:\harbour\source\main\w32\mingw32\harbour.exe $< -o$@ -n -Ic:\harbour\include -Ic:\fwh\include
   
./obj/%.o : ./obj/%.c
   gcc -c -o$@ -Ic:\harbour\include $<   
   
./obj/%.o : %.c
   gcc -c -o$@ -Ic:\harbour\include $<   
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Wed Sep 24, 2008 11:25 am

make.bat
Code: Select all  Expand view
set oldpath=%path%
set path=c:\mingw\bin;%path%
c:\mingw\bin\mingw32-make.exe
set path=%oldpath%
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sun Sep 28, 2008 8:16 am

A new Makefile version that already builds the EXE:

Makefile
Code: Select all  Expand view
# gcc make example for Windows, developed by FiveTech Software

hdir=c:\harbour
hdirc=$(hdir)\source\main\w32\mingw32\harbour.exe
hlibs=$(hdir)\lib\w32\mingw32
fwh=c:\fwh
mingw=c:\mingw

all : test.exe
   test.exe

PRG_OBJS = ./obj/one.c  \
                ./obj/two.c

C_OBJS = ./obj/one.o \
         ./obj/two.o \
         ./obj/three.o

test.exe : $(PRG_OBJS) $(C_OBJS)
   if not exist one.rc $(mingw)\bin\gcc -otest.exe ./obj/one.o ./obj/two.o ./obj/three.o -Wall -s -mwindows -L$(mingw)\lib -L$(hlibs) -L$(fwh)\lib -mno-cygwin -Wl,--start-group -lfivehg -lfivehgc -lgtgui -ldll -lsocket -luser32 -lwinspool -lcomctl32 -lcomdlg32 -lgdi32 -lole32 -loleaut32 -luuid -lwinmm -lvfw32 -lwsock32 -lmsimg32 -lhbbtree -lhbclipsm -lhbcommon -lhbcpage -lhbcplr -lhbct -lhbcurl -lhbfbird -lhbgd -lhbhpdf -lhbhsx -lhblang -lhbmacro -lhbmainstd -lhbmisc -lhbmsql -lhbmysql -lmysqldll -lhbmzip -lhbnf -lhbodbc -lodbc32 -lhbpcre -lhbpgsql -lhbpp -lhbrdd -lhbrtl -lhbsix -lhbsqlit3 -lhbtip -lhbusrrdd -lhbvm -lhbvpdf -lhbw32 -lhbzlib -lrddado -lrddads -lrddcdx -lrddfpt -lrddntx -lxhb -Wl,--end-group
   if exist one.rc $(mingw)\bin\gcc -otest.exe ./obj/one.o ./obj/two.o ./obj/three.o _one.o -Wall -s -mwindows -L$(mingw)\lib -L$(hlibs) -L$(fwh)\lib -mno-cygwin -Wl,--start-group -lfivehg -lfivehgc -lgtgui -ldll -lsocket -luser32 -lwinspool -lcomctl32 -lcomdlg32 -lgdi32 -lole32 -loleaut32 -luuid -lwinmm -lvfw32 -lwsock32 -lmsimg32 -lhbbtree -lhbclipsm -lhbcommon -lhbcpage -lhbcplr -lhbct -lhbcurl -lhbfbird -lhbgd -lhbhpdf -lhbhsx -lhblang -lhbmacro -lhbmainstd -lhbmisc -lhbmsql -lhbmysql -lmysqldll -lhbmzip -lhbnf -lhbodbc -lodbc32 -lhbpcre -lhbpgsql -lhbpp -lhbrdd -lhbrtl -lhbsix -lhbsqlit3 -lhbtip -lhbusrrdd -lhbvm -lhbvpdf -lhbw32 -lhbzlib -lrddado -lrddads -lrddcdx -lrddfpt -lrddntx -lxhb -Wl,--end-group

./obj/%.c : %.prg
   if not exist obj mkdir obj
   $(hdir)\source\main\w32\mingw32\harbour.exe $< -o$@ -n -I$(hdir)\include -I$(fwh)\include
   
./obj/%.o : ./obj/%.c
   gcc -c -o$@ -I$(hdir)\include $<   
   
./obj/%.o : %.c
   gcc -c -o$@ -I$(hdir)\include $<   
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Make-file Test

Postby ukoenig » Sun Sep 28, 2008 5:15 pm

Antonio,

I tested the make file, but it didn't work.
My only changes => c: to d: and filenames.
The used files : brwtools.prg, errsysw.prg and brwtools.rc

My call : Make project
--------------------------

Image

Code: Select all  Expand view
The batch-file MAKE.BAT :
------------------------------

set oldpath=%path%
set path=d:\mingw\bin;%path%
d:\mingw\bin\mingw32-make.exe
set path=%oldpath%

The Make-file PROJECT.RMK :
----------------------------------

# gcc make example for Windows, developed by FiveTech Software

hdir=d:\harbour
hdirc=$(hdir)\source\main\w32\mingw32\harbour.exe
hlibs=$(hdir)\lib\w32\mingw32
fwh=d:\fwh
mingw=d:\mingw

all : brwtools.exe
   brwtools.exe

PRG_OBJS = ./obj/brwtools.c  \
                ./obj/errsysw.c

C_OBJS = ./obj/brwtools.o \
                  ./obj/errsysw.o

brwtools.exe : $(PRG_OBJS) $(C_OBJS)
if not exist brwtools.rc $(mingw)\bin\gcc -o brwtools.exe ./obj/brwtools.o ./obj/errsysw.o -Wall -s -mwindows -L$(mingw)\lib -L$(hlibs) -L$(fwh)\lib -mno-cygwin -Wl,--start-group -lfivehg -lfivehgc -lgtgui -ldll -lsocket -luser32 -lwinspool -lcomctl32 -lcomdlg32 -lgdi32 -lole32 -loleaut32 -luuid -lwinmm -lvfw32 -lwsock32 -lmsimg32 -lhbbtree -lhbclipsm -lhbcommon -lhbcpage -lhbcplr -lhbct -lhbcurl -lhbfbird -lhbgd -lhbhpdf -lhbhsx -lhblang -lhbmacro -lhbmainstd -lhbmisc -lhbmsql -lhbmysql -lmysqldll -lhbmzip -lhbnf -lhbodbc -lodbc32 -lhbpcre -lhbpgsql -lhbpp -lhbrdd -lhbrtl -lhbsix -lhbsqlit3 -lhbtip -lhbusrrdd -lhbvm -lhbvpdf -lhbw32 -lhbzlib -lrddado -lrddads -lrddcdx -lrddfpt -lrddntx -lxhb -Wl,--end-group
if exist brwtools.rc $(mingw)\bin\gcc -o brwtools.exe ./obj/brwtools.o ./obj/errsysw.o _one.o -Wall -s -mwindows -L$(mingw)\lib -L$(hlibs) -L$(fwh)\lib -mno-cygwin -Wl,--start-group -lfivehg -lfivehgc -lgtgui -ldll -lsocket -luser32 -lwinspool -lcomctl32 -lcomdlg32 -lgdi32 -lole32 -loleaut32 -luuid -lwinmm -lvfw32 -lwsock32 -lmsimg32 -lhbbtree -lhbclipsm -lhbcommon -lhbcpage -lhbcplr -lhbct -lhbcurl -lhbfbird -lhbgd -lhbhpdf -lhbhsx -lhblang -lhbmacro -lhbmainstd -lhbmisc -lhbmsql -lhbmysql -lmysqldll -lhbmzip -lhbnf -lhbodbc -lodbc32 -lhbpcre -lhbpgsql -lhbpp -lhbrdd -lhbrtl -lhbsix -lhbsqlit3 -lhbtip -lhbusrrdd -lhbvm -lhbvpdf -lhbw32 -lhbzlib -lrddado -lrddads -lrddcdx -lrddfpt -lrddntx -lxhb -Wl,--end-group

./obj/%.c : %.prg
if not exist obj mkdir obj
$(hdir)\source\main\w32\mingw32\harbour.exe $< -o$@ -n -I$(hdir)\include -I$(fwh)\include
   
./obj/%.o : ./obj/%.c
gcc -c -o$@ -I$(hdir)\include $<   
   
./obj/%.o : %.c
gcc -c -o$@ -I$(hdir)\include $<   



Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Antonio Linares » Sun Sep 28, 2008 6:15 pm

Uwe,

Your make file has to be named "Makefile" (notice the first uppercase).

And you call make.bat (the one that I published) with no parameters
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

RMAKE

Postby ukoenig » Sun Sep 28, 2008 7:56 pm

Antonio,

I changed the file-names to :

Go.bat
Makefile.rmk

I called just Go
I tested with Go Makefile

It was allways the same ( see Dos-Message.box ).
It seems, Mingw32-make.exe cannot connect to Makefile.rmk.
Could be maybe a path-define-problem.

My installs :

D:\FWH
D:\HARBOUR
D:\MINGW

My files : http://www.pflegeplus.com/fw_downloads/TestMinGW.zip

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Antonio Linares » Sun Sep 28, 2008 9:47 pm

Uwe,

> Makefile.rmk

No! :-)

Please rename Makefile.rmk into Makefile

No extension! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 50 guests