A Perl script to generate simple Makefile
(For Linux/Unix and MS Windows)
by
Muhammad A Muquit
genamake.pl
is simple Perl script to generate simple Makefiles. I wrote it because
I wanted to generate simple Makefiles, not unreadable complex junks lots of
auto Makefile generators create. There used to be a shell script called genmake in this page.
genmake.pl
is the Perl incarnation of genmake. It's geared
towards C but after generating the Makefile, you can modify it to fit
any language.
How to use
-
Download
Source File: genmake.pl Size: 12918 bytes MD5 Checksum: cfc9cd4a52e49d33db020fe5f6bfa8da
Last updated: Mar-19-2004
- Check the first line of the script
genmake.pl
, and make sure it points to the correct path of perl. - Rename it to
genmake.pl
mv genmake.txt genamke.pl
chmod 755 genmake.pl
(In Unix)
Synopsis
genmake.pl v1.1 http://muquit.com/muquit/software/
A program to generate nice/simple Makefiles for Linux/Unix and MS Windows
genmake.txt [options]
Where the options include:
--unix generate Makefile for Unix
--win generate Makefile for MS Windows
--app=name generate Makefile for an application
--lib=name generate Makefile for a static library
--dll=name generate Makefile for a shared library in Unix and DLL in Windows
--version show version info
Example:
genmake.txt --unix --app=myapp *.c > Makefile
genmake.txt --win --app=myapp.exe main.c bar.c > Makefile.win
genmake.txt --unix --lib=libmyapp.a main.c bar.c > Makefile
genmake.txt --win --lib=myapp.lib main.c bar.c > Makefile.win
genmake.txt --win --dll=libmyapp.so main.c bar.c > Makefile.win
genmake.txt --win --dll=myapp.dll main.c bar.c > Makefile.win
If no --unix or --win flag is specified, OS type will be guessed
Edit the generated Makefile if nedeed.
Example
$ perl genmake.pl --win --app=foo.exe foo.c main.c > Makefile.win
##----------------------------------------------------------------------------
Copyright
# Created with genmake.pl v1.1 on Fri Mar 19 21:47:20 2004
# genmake.pl home: http://muquit.com/muquit/software/
# Copryright: GNU GPL (http://www.gnu.org/copyleft/gpl.html)
##----------------------------------------------------------------------------
CC= cl
#DEFS= -nologo -DSTRICT -G3 -Ow -W3 -Zp -Tp
DEFS= -nologo -G3
PROGNAME= foo.exe
LINKER=link -nologo
INCLUDES= -I.
# don't define -DSYS_WIN32.. win2k complains
DEFINES= $(INCLUDES) $(DEFS) -DWINNT=1
CFLAGS= $(DEFINES)
GUIFLAGS=user32.lib gdi32.lib winmm.lib comdlg32.lib comctl32.lib
WINSOCK_LIB=wsock32.lib
LIBS=$(WINSOCK_LIB) $(GUIFLAGS)
RC=rc
RCVARS=-r -DWIN32
SRCS = foo.c main.c
OBJS = foo.obj main.obj
.c.obj:
$(CC) $(CFLAGS) -c $< -Fo$@
all: $(PROGNAME)
$(PROGNAME) : $(OBJS)
$(LINKER) $(OBJS) /OUT:$(PROGNAME) $(LIBS)
clean:
del $(OBJS) $(PROGNAME) core
GNU General Public License
Updated: Mar-19-2004
URL of this page: http://www.muquit.com/muquit/software/genmake/genmake.html
留言列表