3 # program to automatically generate an optimized Makefile from an rcb file
4 # it is optimized because it only compiles *used* stuff
5 # use like this: cat myprog.rcb | rcb2make myprog > Makefile
10 my $progname = $ARGV[0] or
11 die ("pass name of executable the makefile has to build");
18 if(/^DEP ([\w_\-\/\
.]+)$/) {
20 } elsif (/^LINK ([\w_\-\/\
.]+)$/) {
34 my $mak_template = << 'EOF';
36 bindir
= $(prefix
)/bin
43 CFLAGS
+= -Wall
-D_GNU_SOURCE
-std
=c99
50 install
-d
$(DESTDIR
)/$(bindir
)
51 install
-D
-m
755 $(PROG
) $(DESTDIR
)/$(bindir)/
58 $(CC
) $(CPPFLAGS
) $(CFLAGS
) $(INC
) $(PIC
) -c
-o
$@
$<
61 $(CC
) $(LDFLAGS
) $(OBJS
) $(LIBS
) -o
$@
63 .PHONY
: all clean install
67 $mak_template =~ s/#PROG#/$progname/;
68 my $lc = make_list
(@c);
69 $mak_template =~ s/#SRCS#/$lc/;
70 my $ll = make_list
(@libs);
71 $mak_template =~ s/#LIBS#/$ll/;