diff --git a/Makefile.pl b/Makefile.pl index 0357735..9adda2a 100755 --- a/Makefile.pl +++ b/Makefile.pl @@ -119,13 +119,16 @@ print("Target : " . $target . "\n"); my @l = (); foreach my $e (param_list()) { + if (not(param_get($e))) { + next; + } if (($e eq "vulkan-string-helper") and param_get("vulkan")) { push(@l, $e); } elsif (($e eq "xrender") and ($backend eq "x11")) { push(@l, $e); } - elsif (not($e eq "vulkan-string-helper") and not($e eq "xrender") and param_get($e)) { + elsif (not($e eq "vulkan-string-helper") and not($e eq "xrender")) { push(@l, $e); } } diff --git a/pl/ostype/NetBSD.pl b/pl/ostype/NetBSD.pl index e38abf5..74ff8d5 100644 --- a/pl/ostype/NetBSD.pl +++ b/pl/ostype/NetBSD.pl @@ -1,6 +1,7 @@ # $Id$ add_incdir("-I/usr/X11R7/include -I/usr/pkg/include"); -add_libdir("-L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib"); +add_libdir( + "-L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib"); use_backend("x11"); 1; diff --git a/pl/ostype/Windows.pl b/pl/ostype/Windows.pl index bed4f3b..98f6f4d 100644 --- a/pl/ostype/Windows.pl +++ b/pl/ostype/Windows.pl @@ -1,8 +1,8 @@ # $Id$ -$library_prefix = ""; -$library_suffix = ".dll"; +$library_prefix = ""; +$library_suffix = ".dll"; $executable_suffix = ".exe"; -$math = ""; +$math = ""; add_ldflags("-Wl,--out-implib,src/libMw.a -static-libgcc"); use_backend("gdi"); diff --git a/pl/rules.pl b/pl/rules.pl index 93aba1f..4a577a6 100644 --- a/pl/rules.pl +++ b/pl/rules.pl @@ -3,39 +3,41 @@ new_object("src/*.c"); my $gl_libs = ""; -if($backend eq "x11"){ - add_cflags("-DUSE_X11"); - new_object("src/backend/x11.c"); - add_libs("-lX11 -lXrender -lXcursor"); +if ($backend eq "x11") { + add_cflags("-DUSE_X11"); + new_object("src/backend/x11.c"); + add_libs("-lX11 -lXrender -lXcursor"); - $gl_libs = "-lGL -lGLU"; -}elsif($backend eq "gdi"){ - add_cflags("-DUSE_GDI"); - new_object("src/backend/gdi.c"); - add_libs("-lgdi32"); + $gl_libs = "-lGL -lGLU"; +} +elsif ($backend eq "gdi") { + add_cflags("-DUSE_GDI"); + new_object("src/backend/gdi.c"); + add_libs("-lgdi32"); - $gl_libs = "-lopengl32 -lglu32"; -}elsif($backend eq "darwin"){ - add_cflags("-DUSE_DARWIN"); - new_object("src/backend/mac/*.c"); - add_ldflags("-framework Carbon"); + $gl_libs = "-lopengl32 -lglu32"; +} +elsif ($backend eq "darwin") { + add_cflags("-DUSE_DARWIN"); + new_object("src/backend/mac/*.c"); + add_ldflags("-framework Carbon"); } -if(param_get("stb-image")){ - add_cflags("-DUSE_STB_IMAGE"); +if (param_get("stb-image")) { + add_cflags("-DUSE_STB_IMAGE"); } -if(param_get("stb-truetype")){ - add_cflags("-DUSE_STB_TRUETYPE"); +if (param_get("stb-truetype")) { + add_cflags("-DUSE_STB_TRUETYPE"); } -if(param_get("freetype2")){ - add_cflags("-DUSE_FREETYPE2"); - if(not($cross)){ - add_cflags(`pkg-config --cflags freetype2`); - add_libs(`pkg-config --libs freetype2`); - } +if (param_get("freetype2")) { + add_cflags("-DUSE_FREETYPE2"); + if (not($cross)) { + add_cflags(`pkg-config --cflags freetype2`); + add_libs(`pkg-config --libs freetype2`); + } } -if(param_get("xrender")){ - add_cflags("-DUSE_XRENDER"); +if (param_get("xrender")) { + add_cflags("-DUSE_XRENDER"); } new_object("src/icon/*.c"); @@ -57,11 +59,12 @@ new_object("src/widget/scrollbar.c"); new_object("src/widget/submenu.c"); new_object("src/widget/viewport.c"); new_object("src/widget/window.c"); -if(param_get("opengl")){ - new_object("src/widget/opengl.c"); + +if (param_get("opengl")) { + new_object("src/widget/opengl.c"); } -if(param_get("vulkan")){ - new_object("src/widget/vulkan.c"); +if (param_get("vulkan")) { + new_object("src/widget/vulkan.c"); } new_object("src/dialog/*.c"); @@ -70,7 +73,6 @@ new_object("src/abstract/*.c"); new_object("external/*.c"); - new_example("examples/basic/example"); new_example("examples/basic/rotate"); new_example("examples/basic/image"); @@ -83,17 +85,17 @@ new_example("examples/basic/listbox"); new_example("examples/basic/progressbar"); new_example("examples/basic/colorpicker"); -if(param_get("opengl")){ - new_example("examples/gldemos/boing", $gl_libs); - new_example("examples/gldemos/clock", $gl_libs); - new_example("examples/gldemos/cube", $gl_libs); - new_example("examples/gldemos/gears", $gl_libs); - new_example("examples/gldemos/triangle", $gl_libs); - new_example("examples/gldemos/tripaint", $gl_libs); +if (param_get("opengl")) { + new_example("examples/gldemos/boing", $gl_libs); + new_example("examples/gldemos/clock", $gl_libs); + new_example("examples/gldemos/cube", $gl_libs); + new_example("examples/gldemos/gears", $gl_libs); + new_example("examples/gldemos/triangle", $gl_libs); + new_example("examples/gldemos/tripaint", $gl_libs); } -if(param_get("vulkan")){ - new_example("examples/vkdemos/vulkan"); +if (param_get("vulkan")) { + new_example("examples/vkdemos/vulkan"); } 1; diff --git a/pl/utils.pl b/pl/utils.pl index a5bf654..236d544 100644 --- a/pl/utils.pl +++ b/pl/utils.pl @@ -1,73 +1,75 @@ # $Id$ sub add_incdir { - my $input = $_[0]; - $input =~ s/\r?\n/ /g; + my $input = $_[0]; + $input =~ s/\r?\n/ /g; - $incdir = "${incdir} ${input}"; + $incdir = "${incdir} ${input}"; } sub add_cflags { - my $input = $_[0]; - $input =~ s/\r?\n/ /g; + my $input = $_[0]; + $input =~ s/\r?\n/ /g; - $cflags = "${cflags} ${input}"; + $cflags = "${cflags} ${input}"; } sub add_libdir { - my $input = $_[0]; - $input =~ s/\r?\n/ /g; + my $input = $_[0]; + $input =~ s/\r?\n/ /g; - $libdir = "${libdir} ${input}"; + $libdir = "${libdir} ${input}"; } sub add_ldflags { - my $input = $_[0]; - $input =~ s/\r?\n/ /g; + my $input = $_[0]; + $input =~ s/\r?\n/ /g; - $ldflags = "${ldflags} ${input}"; + $ldflags = "${ldflags} ${input}"; } sub add_libs { - my $input = $_[0]; - $input =~ s/\r?\n/ /g; + my $input = $_[0]; + $input =~ s/\r?\n/ /g; - $libs = "${libs} ${input}"; + $libs = "${libs} ${input}"; } sub new_example { - if(@_ == 2){ - $examples_libs{"$_[0]${executable_suffix}"} = $_[1]; - } - push(@examples_targets, "${_[0]}${executable_suffix}"); + if (@_ == 2) { + $examples_libs{"$_[0]${executable_suffix}"} = $_[1]; + } + push(@examples_targets, "${_[0]}${executable_suffix}"); } sub new_object { - my @l = glob($_[0]); - foreach my $e (@l){ - $e =~ s/\.c$/$object_suffix/; - push(@library_targets, $e); - } + my @l = glob($_[0]); + foreach my $e (@l) { + $e =~ s/\.c$/$object_suffix/; + push(@library_targets, $e); + } } sub use_backend { - $backend = $_[0]; + $backend = $_[0]; } our %params = (); + sub param_set { - $params{$_[0]} = $_[1]; + $params{ $_[0] } = $_[1]; } sub param_get { - if(not(defined($params{$_[0]}))){ - return 0; - }else{ - return $params{$_[0]}; - } + if (not(defined($params{ $_[0] }))) { + return 0; + } + else { + return $params{ $_[0] }; + } } sub param_list { - return sort(keys(%params)); + return sort(keys(%params)); } 1;