changeset 289:b67a118dbdb7 ccdev

Updated Makefile to install additonal components of lwcc Unlike lwasm, lwlink, and lwar, lwcc requires additional runtime support files. Updated the Makefile to install them.
author William Astle <lost@l-w.ca>
date Sun, 08 Sep 2013 16:55:21 -0600
parents fc76f1a0dc49
children c648fc4bd006
files Makefile
diffstat 1 files changed, 43 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sun Sep 08 15:53:06 2013 -0600
+++ b/Makefile	Sun Sep 08 16:55:21 2013 -0600
@@ -7,12 +7,29 @@
 #PROGSUFFIX := .exe
 #BUILDTPREFIX=i586-mingw32msvc-
 
+LWTOOLS_VERSION = 4.8
+LWTOOLS_VERSION_SUFFIX = -devcc
+
+PACKAGE_VERSION = $(LWTOOLS_VERSION)$(LWTOOLS_VERSION_SUFFIX)
+
+ifeq ($(PREFIX),)
 ifneq ($(DESTDIR),)
-INSTALLDIR = $(DESTDIR)/usr/bin
+PREFIX = /usr
 else
-INSTALLDIR ?= /usr/local/bin
+PREFIX = /usr/local
+endif
 endif
 
+LIBDIR = $(PREFIX)/lib
+BINDIR = $(PREFIX)/bin
+
+INSTALLDIR = $(DESTDIR)$(PREFIX)
+INSTALLBIN = $(DESTDIR)$(BINDIR)
+INSTALLLIB = $(DESTDIR)$(LIBDIR)
+
+LWCC_LIBDIR = $(LIBDIR)/lwcc/$(PACKAGE_VERSION)
+LWCC_INSTALLLIBDIR = $(DESTDIR)$(LWCC_LIBDIR)
+
 # this are probably pointless but they will make sure
 # the variables are set without overriding the environment
 # or automatic values from make itself.
@@ -27,7 +44,9 @@
 RANLIB := $(BUILDTPREFIX)$(RANLIB)
 endif
 
-CPPFLAGS += -I lwlib -DPACKAGE_STRING='"lwtools 4.8"'
+CPPFLAGS += -I lwlib -DPACKAGE_STRING='"lwtools $(PACKAGE_VERSION)"'
+CPPFLAGS += -DPREFIX=$(PREFIX) -DLWCC_LIBDIR=$(LWCC_LIBDIR)
+CPPFLAGS += -DPROGSUFFIX=$(PROGSUFFIX)
 LDFLAGS += -L$(PWD)/lwlib -llw
 
 CFLAGS ?= -O3 -Wall
@@ -35,7 +54,12 @@
 MAIN_TARGETS := lwasm/lwasm$(PROGSUFFIX) \
 	lwlink/lwlink$(PROGSUFFIX) \
 	lwar/lwar$(PROGSUFFIX) \
-	lwlink/lwobjdump$(PROGSUFFIX)
+	lwlink/lwobjdump$(PROGSUFFIX) \
+	lwcc/driver/lwcc$(PROGSUFFIX)
+
+LWCC_LIBBIN_FILES =
+LWCC_LIBLIB_FILES =
+LWCC_LIBINC_FILES =
 
 .PHONY: all
 all: $(MAIN_TARGETS)
@@ -151,8 +175,21 @@
 
 .PHONY: install
 install:
-	install -d $(INSTALLDIR)
-	install $(MAIN_TARGETS) $(INSTALLDIR)
+	install -d $(INSTALLBIN)
+	install $(MAIN_TARGETS) $(INSTALLBIN)
+	install -d $(LWCC_INSTALLLIBDIR)
+	install -d $(LWCC_INSTALLLIBDIR)/bin
+	install -d $(LWCC_INSTALLLIBDIR)/lib
+	install -d $(LWCC_INSTALLLIBDIR)/include
+ifneq ($(LWCC_LIBBIN_FILES),)
+	install $(LWCC_LIBBIN_FILES) $(LIBCC_INSTALLLIBDIR)/bin
+endif
+ifneq ($(LWCC_LIBLIB_FILES),)
+	install $(LWCC_LIBLIB_FILES) $(LIBCC_INSTALLLIBDIR)/lib
+endif
+ifneq ($(LWCC_LIBINC_FILES),)
+	install $(LWCC_LIBINC_FILES) $(LIBCC_INSTALLLIBDIR)/include
+endif
 
 .PHONY: test
 test: all test/runtests