diff --git a/.editorconfig b/.editorconfig index f942842a..74844c8f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,3 +9,7 @@ trim_trailing_whitespace = true [meson.build] indent_size = 4 + +[Makefile.*] +indent_size = 4 +indent_style = tab diff --git a/Makefile.mos b/Makefile.mos index b05074ba..4b029cfc 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -1,5 +1,6 @@ # # Project: Lite XL +# Makefile for MorphOS # # Created on: 26-12-2021 # @@ -11,15 +12,26 @@ LiteXL_OBJ := \ src/api/utf8.o src/platform/morphos.o \ src/api/dirmonitor/mos.o src/platform/codesets.o -outfile := lite-xl -compiler := ppc-morphos-gcc-11 -cxxcompiler := ppc-morphos-g++-11 +BIN := lite-xl +CC := ppc-morphos-gcc-11 +STRIP := strip -INCPATH := -Isrc -Ilib/dmon -I/sdk/gg/usr/local/include/SDL2 \ - -I/sdk/gg/usr/include/freetype -I/sdk/gg/usr/include/lua5.4 -DFLAGS ?= -D__USE_INLINE__ CFLAGS ?= -Wall -Wwrite-strings -O2 -noixemul -g -std=gnu11 -fno-strict-aliasing -LFLAGS ?= -noixemul -lpcre2-8 -lSDL2 -llua54 -lagg -lfreetype -lm -lc -L/usr/local/lib +DFLAGS ?= + +ifeq ($(UNAME), morphos) + INCPATH := -Isrc -Ilib/dmon -I/sdk/gg/usr/local/include/SDL2 \ + -I/sdk/gg/usr/include/freetype -I/sdk/gg/usr/include/lua5.4 + LFLAGS ?= -noixemul -lpcre2-8 -lSDL2 -llua54 -lagg -lfreetype -lm -lc \ + -L/usr/local/lib + DEL := delete ALL QUIET FORCE + LHA := lha -aeqr3 a +else + INCPATH := -Isrc -I/gg/include/lua54 -I/gg/include/SDL2 + LFLAGS ?= -noixemul -lpcre2-8 -lSDL2 -lGL -llua54 -lfreetype -lm + DEL := rm -rf + LHA := lha aq +endif ifeq ($(DEBUG),1) CFLAGS += -g -gstabs @@ -36,11 +48,11 @@ clean: LiteXL: $(LiteXL_OBJ) @echo "Linking LiteXL" - $(compiler) -o $(outfile) $(LiteXL_OBJ) $(LFLAGS) + $(CC) -o $(BIN) $(LiteXL_OBJ) $(LFLAGS) .c.o: @echo "Compiling $<" - $(compiler) -c $< -o $*.o $(CFLAGS) $(INCPATH) $(DFLAGS) + $(CC) -c $< -o $*.o $(CFLAGS) $(INCPATH) $(DFLAGS) src/main.o: src/main.c src/api/api.h src/rencache.h \ src/renderer.h src/platform/morphos.h src/platform/codesets.h @@ -77,13 +89,13 @@ release: clean LiteXL @rm release/LiteXL2/AutoInstall @cp -r data release/LiteXL2/ @cp changelog.md release/LiteXL2/ - @cp $(outfile) release/LiteXL2/ - @strip release/LiteXL2/$(outfile) + @cp $(BIN) release/LiteXL2/ + @$(STRIP) release/LiteXL2/$(BIN) @cp README.md release/LiteXL2/ @cp README_Amiga.md release/LiteXL2/ @cp LICENSE release/LiteXL2/ @cp -r licenses release/LiteXL2/ @echo "Creating release archive..." - @lha -aeqr3 a LiteXL2_MOS.lha release/ + @$(LHA) LiteXL2_MOS.lha release/ @echo "Clean release files..." - @delete release ALL QUIET FORCE + @$(DEL) release diff --git a/Makefile.os4 b/Makefile.os4 index 7590da39..2f23e4b0 100644 --- a/Makefile.os4 +++ b/Makefile.os4 @@ -1,5 +1,6 @@ # # Project: Lite XL +# Makefile for AmigaOS 4 # # Created on: 26-12-2021 # @@ -11,27 +12,37 @@ LiteXL_OBJ := \ src/api/utf8.o src/platform/amigaos4.o \ src/api/dirmonitor/os4.o src/platform/codesets.o -outfile := lite-xl -compiler := gcc -cxxcompiler := g++ +BIN := lite-xl +CC := ppc-amigaos-gcc +STRIP := ppc-amigaos-strip -INCPATH := -Isrc -I/sdk/local/newlib/include/SDL2 \ - -I/sdk/local/common/include/lua54 -I/sdk/local/common/include/freetype2 +ifeq ($(UNAME), AmigaOS) + SDKPATH := /sdk + DEL := delete ALL QUIET FORCE + LHA := lha -aeqr3 a +else + SDKPATH := $(SDK_PATH) + DEL := rm -rf + LHA := lha aq +endif -DFLAGS += -D__USE_INLINE__ -DLITE_XL_DATA_USE_EXEDIR +INCPATH := -Isrc -I$(SDKPATH)/local/newlib/include/SDL2 \ + -I$(SDKPATH)/local/common/include/lua54 \ + -I$(SDKPATH)/local/common/include/freetype2 + +DFLAGS += -D__USE_INLINE__ CFLAGS ?= -Werror -Wwrite-strings -O3 -std=gnu11 -fno-strict-aliasing LFLAGS ?= -mcrt=newlib -lpcre2-8 -lSDL2 -llua54 -lfreetype -lpng -lz \ -lpthread -athread=native ifeq ($(DEBUG),1) -CFLAGS += -g -gstabs -LFLAGS += -gstabs - -ifeq ($(PROFYLER),1) -CFLAGS += -finstrument-functions -fno-inline -DPROFILING -LFLAGS += -lprofyle -endif + CFLAGS += -g -gstabs + LFLAGS += -gstabs + ifeq ($(PROFYLER),1) + CFLAGS += -finstrument-functions -fno-inline -DPROFILING + LFLAGS += -lprofyle + endif endif @@ -45,12 +56,12 @@ clean: LiteXL: $(LiteXL_OBJ) @echo "Linking LiteXL" - @$(compiler) -o $(outfile) $(LiteXL_OBJ) $(LFLAGS) + @$(CC) -o $(BIN) $(LiteXL_OBJ) $(LFLAGS) .c.o: @echo "Compiling $<" - @$(compiler) -c $< -o $*.o $(CFLAGS) $(INCPATH) $(DFLAGS) + @$(CC) -c $< -o $*.o $(CFLAGS) $(INCPATH) $(DFLAGS) src/main.o: src/main.c src/api/api.h src/rencache.h \ @@ -90,13 +101,13 @@ release: clean LiteXL @mv release/LiteXL2/AutoInstall release/ @cp -r data release/LiteXL2/ @cp changelog.md release/LiteXL2/ - @cp $(outfile) release/LiteXL2/ - @strip release/LiteXL2/$(outfile) + @cp $(BIN) release/LiteXL2/ + @$(STRIP) release/LiteXL2/$(BIN) @cp README.md release/LiteXL2/ @cp README_Amiga.md release/LiteXL2/ @cp LICENSE release/LiteXL2/ @cp -r licenses release/LiteXL2/ @echo "Creating release archive..." - @lha -aeqr3 a LiteXL2_OS4.lha release/ + @$(LHA) LiteXL2_OS4.lha release/ @echo "Clean release files..." - @delete release ALL QUIET FORCE + @$(DEL) release