From ad6e922e074116d716a12e585947959b101d94cc Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sat, 12 Oct 2019 17:25:38 -0400 Subject: [PATCH] change build system to rscons --- .gitignore | 1 + LoadFile/Makefile | 17 ----------- Makefile | 78 +++-------------------------------------------- Rsconscript | 15 ++++++++- configure | 2 ++ ss/Makefile | 18 ----------- 6 files changed, 21 insertions(+), 110 deletions(-) delete mode 100644 LoadFile/Makefile create mode 100755 configure delete mode 100644 ss/Makefile diff --git a/.gitignore b/.gitignore index 04e9c23..e6a9f65 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /build/ /.rscons* /dwscr +/LoadFile/LoadFile-gen.inc diff --git a/LoadFile/Makefile b/LoadFile/Makefile deleted file mode 100644 index ca32666..0000000 --- a/LoadFile/Makefile +++ /dev/null @@ -1,17 +0,0 @@ - -GENLOADFILE := perl genLoadFile.pl -LOGO_PATH := ../logo -LOADFILES += dwlogo.obj -LOADFILES += dwlogo.mtl -ABSLOADFILES := $(foreach lf,$(LOADFILES),$(LOGO_PATH)/$(lf)) - -all: LoadFile.o - -LoadFile.o: LoadFile.cc LoadFile-gen.inc - $(CXX) -c -o $@ $< $(CPPFLAGS) $(CXXFLAGS) - -LoadFile-gen.inc: genLoadFile.pl $(ABSLOADFILES) - $(GENLOADFILE) --root=$(LOGO_PATH) $(LOADFILES) - -clean: - -$(RM) -f *~ *.o LoadFile-gen.inc diff --git a/Makefile b/Makefile index a867011..35a399a 100644 --- a/Makefile +++ b/Makefile @@ -1,77 +1,7 @@ - -# Author: Josh Holtrop -# DornerWorks screensaver - -# set this to compile in "debug" mode -#DEBUG := 1 - -WINCHECK := $(shell which msys-1.0.dll >/dev/null 2>&1; if [ $$? -eq 0 ]; then echo MSYS; fi) -ifeq ($(strip $(WINCHECK)),) -WINDOWS := 0 -else -WINDOWS := 1 -endif - -export CPPFLAGS += -I"$(shell pwd)" - -OBJS = dwscr.o wfobj/WFObj.o LoadFile/LoadFile.o ss/ss.a -TARGET = dwscr -export CXXFLAGS := -O2 -Wall -export CPPFLAGS - -ifdef DEBUG -CPPFLAGS += -DDEBUG -CPPFLAGS += -g -endif - -ifeq ($(WINDOWS),1) -LDFLAGS += -lopengl32 -lglu32 -lmingw32 -TARGET := $(TARGET).exe -SSNAME := dwscr.scr -INSTALLDIR := C:/WINDOWS -OBJS += displayinfo-win32.o -else -LDFLAGS += -lGL -lGLU -OBJS += displayinfo.o -endif - -LDFLAGS += $(shell sdl-config --libs) -export CPPFLAGS += $(shell sdl-config --cflags) - -ifdef WITHOUT_ODE -CPPFLAGS += -DWITHOUT_ODE -else -CPPFLAGS += $(shell ode-config --cflags) -LDFLAGS += $(shell ode-config --libs) -endif - - -all: $(TARGET) - -$(TARGET): $(OBJS) - $(CXX) -o $@ $(OBJS) $(LDFLAGS) - -.PHONY: wfobj/WFObj.o -wfobj/WFObj.o: - $(MAKE) -C wfobj - -.PHONY: LoadFile/LoadFile.o -LoadFile/LoadFile.o: - $(MAKE) -C LoadFile - -.PHONY: ss/ss.a -ss/ss.a: - $(MAKE) -C ss - -ifeq ($(WINDOWS),1) -.PHONY: install -install: - cp $(TARGET) $(INSTALLDIR)/$(SSNAME) -endif +.PHONY: all +all: + ./rscons build .PHONY: clean clean: - $(MAKE) -C wfobj clean - $(MAKE) -C LoadFile clean - $(MAKE) -C ss clean - -$(RM) -f *~ *.o $(TARGET) + ./rscons clean diff --git a/Rsconscript b/Rsconscript index 92df0bc..1532f9e 100644 --- a/Rsconscript +++ b/Rsconscript @@ -18,7 +18,15 @@ end build do Environment.new do |env| - system("make -C LoadFile") + env.add_builder(:GenLoadFile) do |params| + command = ["perl", "genLoadFile.pl", "--root=../logo", "dwlogo.obj", "dwlogo.mtl"] + unless @cache.up_to_date?(@target, command, @sources, @env) + print_run_message("GenLoadFile #{@target}", nil) + system(*command, chdir: "LoadFile") + @cache.register_build(@target, command, @sources, @env) + end + true + end env["CCFLAGS"] = %w[-O2 -Wall] env["CPPPATH"] += %w[.] sources = ["dwscr.cc", "wfobj/WFObj.cc", "LoadFile/LoadFile.cc"] + glob("ss/*.{cc,cpp}") @@ -27,6 +35,11 @@ build do else sources += ["displayinfo.cc"] end + loadfiles = %w[ + logo/dwlogo.obj + logo/dwlogo.mtl + ] + loadfile_gen = env.GenLoadFile("LoadFile/LoadFile-gen.inc", loadfiles + ["LoadFile/genLoadFile.pl"]) dwscr = env.Program("dwscr", sources) if RUBY_PLATFORM =~ /mingw/ env.Install("C:/Windows/dwscr.scr", dwscr) diff --git a/configure b/configure new file mode 100755 index 0000000..1bd4faa --- /dev/null +++ b/configure @@ -0,0 +1,2 @@ +#!/bin/sh +exec "$(dirname "$0")"/rscons "$@" diff --git a/ss/Makefile b/ss/Makefile deleted file mode 100644 index 73138f5..0000000 --- a/ss/Makefile +++ /dev/null @@ -1,18 +0,0 @@ - -OBJS := SSMain.o -OBJS += SSMode.o -OBJS += LogoBox.o -OBJS += PlainSpin.o -OBJS += LightBounce.o -ifndef WITHOUT_ODE -OBJS += TumblingLogos.o -OBJS += Towers.o -endif -AROBJS := $(foreach o,$(OBJS),ss.a($(o))) - -all: ss.a - -ss.a: $(AROBJS) - -clean: - -$(RM) -f *~ *.o *.a