mirror of
https://github.com/Interlisp/maiko.git
synced 2026-03-20 16:28:12 +00:00
For Linux makefiles, automated selection of gcc versus clang compiler depending on whats installed. Refactored Linux makefiles to simplify top level makefiles with slightly more complicated common makefiles. Makefiles for Cygwin and WSL1 all rewritten to use the common linux makefiles code.
This commit is contained in:
@@ -1,15 +1,33 @@
|
||||
# Common Options for All Linuxes
|
||||
|
||||
CC = gcc $(GCC_CFLAGS)
|
||||
# CC = clang $(CLANG_CFLAGS)
|
||||
include linux-compiler.mk
|
||||
|
||||
include linux-libbsd.mk
|
||||
ifeq ($(USE_LIBBSD),T)
|
||||
include linux-libbsd.mk
|
||||
else
|
||||
BSD_CFLAGS :=
|
||||
BSD_LDFLAGS :=
|
||||
endif
|
||||
|
||||
# OPTFLAGS is normally -O2.
|
||||
OPTFLAGS = -O2 -g3
|
||||
ifeq ($(USE_DISPLAY),x)
|
||||
include linux-x.mk
|
||||
DEFAULT_TARGET := ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex
|
||||
endif
|
||||
ifeq ($(USE_DISPLAY),sdl)
|
||||
include linux-sdl.mk
|
||||
DEFAULT_TARGET := ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
|
||||
endif
|
||||
ifeq ($(USE_DISPLAY),init)
|
||||
include linux-x.mk
|
||||
DEFAULT_TARGET := ../$(OSARCHNAME)/ldeinit
|
||||
endif
|
||||
|
||||
OPTFLAGS ?= -O2 -g3
|
||||
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) $(BSD_CFLAGS) $(ADDITIONAL_DFLAGS)
|
||||
|
||||
LDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS)
|
||||
LDELDFLAGS = $(XLDFLAGS) -lc -lm $(BSD_LDFLAGS)
|
||||
|
||||
OBJECTDIR = ../$(RELEASENAME)/
|
||||
|
||||
default: $(DEFAULT_TARGET)
|
||||
|
||||
40
bin/linux-compiler.mk
Normal file
40
bin/linux-compiler.mk
Normal file
@@ -0,0 +1,40 @@
|
||||
# Select whether to use clang or gcc
|
||||
# Priority
|
||||
# 1. If -DUSE_GCC or -DUSE_CLANG on command line (but not both) use the requested compiler.
|
||||
# 2. If one compiler is installed but not the other, use the installed compiler.
|
||||
# 3. Use clang
|
||||
|
||||
EXISTS_GCC := $(shell command -v gcc)
|
||||
EXISTS_CLANG := $(shell command -v clang)
|
||||
ifeq ($(or $(EXISTS_GCC),$(EXISTS_CLANG)),)
|
||||
$(error "Cannot find compiler: neither gcc nor clang. Exiting.")
|
||||
endif
|
||||
ifneq ($(and $(USE_CLANG),$(USE_GCC)),)
|
||||
$(error "Cannot use both USE_CLANG=T and USE_GCC=T. Exiting.")
|
||||
endif
|
||||
COMPILER :=
|
||||
ifdef USE_CLANG
|
||||
ifeq ($(EXISTS_CLANG),)
|
||||
$(error "USE_CLANG=T given, but cannot find the clang compiler. Exiting")
|
||||
endif
|
||||
COMPILER := clang
|
||||
endif
|
||||
ifdef USE_GCC
|
||||
ifeq ($(EXISTS_GCC),)
|
||||
$(error "USE_GCC=T given, but cannot find the gcc compiler. Exiting")
|
||||
endif
|
||||
COMPILER := gcc
|
||||
endif
|
||||
ifeq ($(COMPILER),)
|
||||
ifneq ($(EXISTS_CLANG),)
|
||||
COMPILER := clang
|
||||
else
|
||||
COMPILER := gcc
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(COMPILER),gcc)
|
||||
CC := gcc $(GCC_CFLAGS)
|
||||
else
|
||||
CC := clang $(CLANG_CFLAGS)
|
||||
endif
|
||||
@@ -10,5 +10,5 @@ XFILES = $(OBJECTDIR)sdl.o
|
||||
#
|
||||
XFLAGS = -DSDL=2
|
||||
|
||||
XLDFLAGS = -lSDL2
|
||||
XLDFLAGS ?= -lSDL2
|
||||
|
||||
|
||||
@@ -1,26 +1,9 @@
|
||||
# Options for Linux, Intel x86_64 and X-Window
|
||||
|
||||
CC = gcc -m64 $(GCC_CFLAGS) -I/usr/local/include
|
||||
#CC = clang -m64 $(CLANG_CFLAGS)
|
||||
GCC_CFLAGS := -m64 $(GCC_CFLAGS) -I/usr/local/include
|
||||
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS) -I/usr/local/include
|
||||
USE_DISPLAY=sdl
|
||||
USE_LIBBSD=F
|
||||
XLDFLAGS := -L/usr/local/lib -lSDL2
|
||||
|
||||
XFILES = $(OBJECTDIR)sdl.o
|
||||
|
||||
#
|
||||
# For SDL version 2
|
||||
# -DSDL=2 in XFLAGS and -lSDL2 in LDFLAGS
|
||||
# For SDL version 3
|
||||
# -DSDL=3 in XFLAGS and -lSDL3 in LDFLAGS
|
||||
#
|
||||
XFLAGS = -DSDL=2
|
||||
|
||||
# OPTFLAGS is normally -O2.
|
||||
OPTFLAGS = -O2 -g3
|
||||
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE)
|
||||
|
||||
LDFLAGS = -lm -L/usr/local/lib -lSDL2
|
||||
#
|
||||
LDELDFLAGS =
|
||||
|
||||
OBJECTDIR = ../$(RELEASENAME)/
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
|
||||
include linux-common.mk
|
||||
|
||||
@@ -1,28 +1,9 @@
|
||||
# Options for Linux, Intel x86_64 and X-Window
|
||||
# Options for Cygwin, Intel x86_64 and X-Window
|
||||
|
||||
#CC = gcc -m64 $(GCC_CFLAGS)
|
||||
CC = clang -m64 $(CLANG_CFLAGS)
|
||||
GCC_CFLAGS := -m64 $(GCC_CFLAGS)
|
||||
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
|
||||
USE_DISPLAY=x
|
||||
USE_LIBBSD=F
|
||||
|
||||
XFILES = $(OBJECTDIR)xmkicon.o \
|
||||
$(OBJECTDIR)xbbt.o \
|
||||
$(OBJECTDIR)dspif.o \
|
||||
$(OBJECTDIR)xinit.o \
|
||||
$(OBJECTDIR)xscroll.o \
|
||||
$(OBJECTDIR)xcursor.o \
|
||||
$(OBJECTDIR)xlspwin.o \
|
||||
$(OBJECTDIR)xrdopt.o \
|
||||
$(OBJECTDIR)xwinman.o
|
||||
include linux-common.mk
|
||||
|
||||
|
||||
XFLAGS = -DXWINDOW
|
||||
|
||||
# OPTFLAGS is normally -O2.
|
||||
OPTFLAGS = -O2 -g3
|
||||
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE)
|
||||
|
||||
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
|
||||
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm
|
||||
|
||||
OBJECTDIR = ../$(RELEASENAME)/
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
# Options for Linux, aarch64 processor, X windows, for INIT processing
|
||||
|
||||
include linux-x.mk
|
||||
|
||||
OPTFLAGS = -O0 -g
|
||||
DEBUGFLAGS =
|
||||
ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT
|
||||
USE_LIBBSD=T
|
||||
USE_DISPLAY=init
|
||||
|
||||
include linux-common.mk
|
||||
|
||||
OPTFLAGS = -O0 -g
|
||||
|
||||
default : ../$(OSARCHNAME)/ldeinit
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
# Options for Linux, x86 processor, X windows, for INIT processing
|
||||
|
||||
include linux-x.mk
|
||||
|
||||
OPTFLAGS = -O0 -g
|
||||
DEBUGFLAGS =
|
||||
ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT
|
||||
USE_LIBBSD=T
|
||||
USE_DISPLAY=init
|
||||
|
||||
include linux-common.mk
|
||||
|
||||
OPTFLAGS = -O0 -g
|
||||
|
||||
default : ../$(OSARCHNAME)/ldeinit
|
||||
|
||||
@@ -1,29 +1,9 @@
|
||||
# Options for Windows System for Linux v1, aarch64 processor, X windows, for INIT processing
|
||||
|
||||
CC = gcc $(GCC_CFLAGS)
|
||||
#CC = clang $(CLANG_CFLAGS)
|
||||
|
||||
XFILES = $(OBJECTDIR)xmkicon.o \
|
||||
$(OBJECTDIR)xbbt.o \
|
||||
$(OBJECTDIR)dspif.o \
|
||||
$(OBJECTDIR)xinit.o \
|
||||
$(OBJECTDIR)xscroll.o \
|
||||
$(OBJECTDIR)xcursor.o \
|
||||
$(OBJECTDIR)xlspwin.o \
|
||||
$(OBJECTDIR)xrdopt.o \
|
||||
$(OBJECTDIR)xwinman.o
|
||||
|
||||
|
||||
XFLAGS = -DXWINDOW
|
||||
|
||||
# OPTFLAGS is normally -O2, for INIT we want unoptimized in case we need to debug it
|
||||
OPTFLAGS = -O0 -g
|
||||
DEBUGFLAGS =
|
||||
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=$(RELEASE) -DNOVERSION -DINIT -D__wsl1__
|
||||
ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT -D__wsl1__
|
||||
USE_LIBBSD=T
|
||||
USE_DISPLAY=init
|
||||
|
||||
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
|
||||
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
|
||||
|
||||
OBJECTDIR = ../$(RELEASENAME)/
|
||||
|
||||
default : ../$(OSARCHNAME)/ldeinit
|
||||
include linux-common.mk
|
||||
|
||||
@@ -1,29 +1,9 @@
|
||||
# Options for Windows System for Linux v1, Intel x86_64 processor, X windows, for INIT processing
|
||||
|
||||
CC = gcc $(GCC_CFLAGS)
|
||||
#CC = clang $(CLANG_CFLAGS)
|
||||
|
||||
XFILES = $(OBJECTDIR)xmkicon.o \
|
||||
$(OBJECTDIR)xbbt.o \
|
||||
$(OBJECTDIR)dspif.o \
|
||||
$(OBJECTDIR)xinit.o \
|
||||
$(OBJECTDIR)xscroll.o \
|
||||
$(OBJECTDIR)xcursor.o \
|
||||
$(OBJECTDIR)xlspwin.o \
|
||||
$(OBJECTDIR)xrdopt.o \
|
||||
$(OBJECTDIR)xwinman.o
|
||||
|
||||
|
||||
XFLAGS = -DXWINDOW
|
||||
|
||||
# OPTFLAGS is normally -O2, for INIT we want unoptimized in case we need to debug it
|
||||
OPTFLAGS = -O0 -g
|
||||
DEBUGFLAGS =
|
||||
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) -DRELEASE=$(RELEASE) -DNOVERSION -DINIT -D__wsl1__
|
||||
ADDITIONAL_DFLAGS = $(DEBUGFLAGS) -DNOVERSION -DINIT -D__wsl1__
|
||||
USE_LIBBSD=T
|
||||
USE_DISPLAY=init
|
||||
|
||||
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
|
||||
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
|
||||
|
||||
OBJECTDIR = ../$(RELEASENAME)/
|
||||
|
||||
default : ../$(OSARCHNAME)/ldeinit
|
||||
include linux-common.mk
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
GCC_CFLAGS := -m64 $(GCC_CFLAGS)
|
||||
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
|
||||
|
||||
include linux-sdl.mk
|
||||
USE_DISPLAY=sdl
|
||||
USE_LIBBSD=T
|
||||
|
||||
include linux-common.mk
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
GCC_CFLAGS := -m32 $(GCC_CFLAGS)
|
||||
CLANG_CFLAGS := -m32 $(CLANG_CFLAGS)
|
||||
|
||||
include linux-x.mk
|
||||
USE_DISPLAY=x
|
||||
USE_LIBBSD=T
|
||||
|
||||
include linux-common.mk
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Options for Linux, ARM64 and SDL
|
||||
|
||||
include linux-sdl.mk
|
||||
USE_DISPLAY=sdl
|
||||
USE_LIBBSD=T
|
||||
|
||||
include linux-common.mk
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Options for Linux, aarch64 and X-Window
|
||||
|
||||
include linux-x.mk
|
||||
USE_DISPLAY=x
|
||||
USE_LIBBSD=T
|
||||
|
||||
include linux-common.mk
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Options for Linux, ARMv7 and SDL
|
||||
|
||||
include linux-sdl.mk
|
||||
USE_DISPLAY=sdl
|
||||
USE_LIBBSD=T
|
||||
|
||||
include linux-common.mk
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Options for Linux, ARMv7 and X-Window
|
||||
|
||||
include linux-x.mk
|
||||
USE_DISPLAY=x
|
||||
USE_LIBBSD=T
|
||||
|
||||
include linux-common.mk
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
GCC_CFLAGS := -m64 $(GCC_CFLAGS)
|
||||
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
|
||||
|
||||
include linux-sdl.mk
|
||||
USE_DISPLAY=sdl
|
||||
USE_LIBBSD=T
|
||||
|
||||
include linux-common.mk
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
|
||||
GCC_CFLAGS := -m64 $(GCC_CFLAGS)
|
||||
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
|
||||
|
||||
include linux-x.mk
|
||||
USE_DISPLAY=x
|
||||
USE_LIBBSD=T
|
||||
|
||||
include linux-common.mk
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex
|
||||
|
||||
@@ -1,25 +1,7 @@
|
||||
# Options for Windows System for Linux v1, ARM64 and SDL
|
||||
|
||||
CC = gcc $(GCC_CFLAGS)
|
||||
#CC = clang $(CLANG_CFLAGS)
|
||||
USE_DISPLAY=sdl
|
||||
USE_LIBBSD=T
|
||||
ADDITIONAL_DFLAGS := -D__wsl1__
|
||||
|
||||
XFILES = $(OBJECTDIR)sdl.o
|
||||
|
||||
#
|
||||
# For SDL version 2
|
||||
# -DSDL=2 in SDLFLAGS and -lSDL2 in LDFLAGS
|
||||
# For SDL version 3
|
||||
# -DSDL=3 in SDLFLAGS and -lSDL3 in LDFLAGS
|
||||
#
|
||||
SDLFLAGS = -DSDL=2
|
||||
|
||||
# OPTFLAGS is normally -O2.
|
||||
OPTFLAGS = -O2 -g3
|
||||
DFLAGS = $(SDLFLAGS) -DRELEASE=$(RELEASE) -D__wsl1__
|
||||
|
||||
LDFLAGS = -lSDL2 -lm -lbsd
|
||||
LDELDFLAGS = -lbsd
|
||||
|
||||
OBJECTDIR = ../$(RELEASENAME)/
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
|
||||
include linux-common.mk
|
||||
|
||||
@@ -1,27 +1,7 @@
|
||||
# Options for Windows System for Linux v1, aarch64 and X-Window
|
||||
|
||||
CC = gcc $(GCC_CFLAGS)
|
||||
#CC = clang $(CLANG_CFLAGS)
|
||||
USE_DISPLAY=x
|
||||
USE_LIBBSD=T
|
||||
ADDITIONAL_DFLAGS := -D__wsl1__
|
||||
|
||||
XFILES = $(OBJECTDIR)xmkicon.o \
|
||||
$(OBJECTDIR)xbbt.o \
|
||||
$(OBJECTDIR)dspif.o \
|
||||
$(OBJECTDIR)xinit.o \
|
||||
$(OBJECTDIR)xscroll.o \
|
||||
$(OBJECTDIR)xcursor.o \
|
||||
$(OBJECTDIR)xlspwin.o \
|
||||
$(OBJECTDIR)xrdopt.o \
|
||||
$(OBJECTDIR)xwinman.o
|
||||
|
||||
XFLAGS = -DXWINDOW
|
||||
|
||||
# OPTFLAGS is normally -O2.
|
||||
OPTFLAGS = -O2 -g3
|
||||
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) -D__wsl1__
|
||||
|
||||
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
|
||||
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
|
||||
|
||||
OBJECTDIR = ../$(RELEASENAME)/
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex
|
||||
include linux-common.mk
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
# Options for Windows System for Linux v1, Intel x86_64 and SDL
|
||||
|
||||
CC = gcc -m64 $(GCC_CFLAGS)
|
||||
# CC = clang -m64 $(CLANG_CFLAGS)
|
||||
GCC_CFLAGS := -m64 $(GCC_CFLAGS)
|
||||
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
|
||||
USE_DISPLAY=sdl
|
||||
USE_LIBBSD=T
|
||||
ADDITIONAL_DFLAGS := -D__wsl1__
|
||||
|
||||
XFILES = $(OBJECTDIR)sdl.o
|
||||
|
||||
#
|
||||
# For SDL version 2
|
||||
# -DSDL=2 in XFLAGS and -lSDL2 in LDFLAGS
|
||||
# For SDL version 3
|
||||
# -DSDL=3 in XFLAGS and -lSDL3 in LDFLAGS
|
||||
#
|
||||
XFLAGS = -DSDL=2
|
||||
|
||||
# OPTFLAGS is normally -O2.
|
||||
OPTFLAGS = -O2 -g3
|
||||
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) -D__wsl1__
|
||||
|
||||
LDFLAGS = -lm -lSDL2 -lbsd
|
||||
LDELDFLAGS = -lbsd
|
||||
|
||||
OBJECTDIR = ../$(RELEASENAME)/
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl
|
||||
include linux-common.mk
|
||||
|
||||
@@ -1,28 +1,9 @@
|
||||
# Options for Windows System for Linux v1, Intel x86_64 and X-Window
|
||||
|
||||
CC = gcc -m64 $(GCC_CFLAGS)
|
||||
# CC = clang -m64 $(CLANG_CFLAGS)
|
||||
GCC_CFLAGS := -m64 $(GCC_CFLAGS)
|
||||
CLANG_CFLAGS := -m64 $(CLANG_CFLAGS)
|
||||
USE_DISPLAY=x
|
||||
USE_LIBBSD=T
|
||||
ADDITIONAL_DFLAGS := -D__wsl1__
|
||||
|
||||
XFILES = $(OBJECTDIR)xmkicon.o \
|
||||
$(OBJECTDIR)xbbt.o \
|
||||
$(OBJECTDIR)dspif.o \
|
||||
$(OBJECTDIR)xinit.o \
|
||||
$(OBJECTDIR)xscroll.o \
|
||||
$(OBJECTDIR)xcursor.o \
|
||||
$(OBJECTDIR)xlspwin.o \
|
||||
$(OBJECTDIR)xrdopt.o \
|
||||
$(OBJECTDIR)xwinman.o
|
||||
|
||||
|
||||
XFLAGS = -DXWINDOW
|
||||
|
||||
# OPTFLAGS is normally -O2.
|
||||
OPTFLAGS = -O2 -g3
|
||||
DFLAGS = $(XFLAGS) -DRELEASE=$(RELEASE) -D__wsl1__
|
||||
|
||||
LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
|
||||
LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lbsd
|
||||
|
||||
OBJECTDIR = ../$(RELEASENAME)/
|
||||
|
||||
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex
|
||||
include linux-common.mk
|
||||
|
||||
Reference in New Issue
Block a user