Tweaked makefiles to enable cross compiling.
This commit is contained in:
parent
d6982e80ca
commit
5071057e07
47
common.mk
47
common.mk
|
@ -1,17 +1,7 @@
|
||||||
PROG = tbftss
|
|
||||||
|
|
||||||
TARGET = $(PROG)$(EXEEXT)
|
|
||||||
|
|
||||||
VERSION = 0.4
|
VERSION = 0.4
|
||||||
REVISION = $(shell date +"%y%m%d")
|
REVISION = $(shell date +"%y%m%d")
|
||||||
DEBUG = 0
|
DEBUG = 0
|
||||||
|
|
||||||
CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDEBUG=$(DEBUG) -DDATA_DIR=\"$(DATA_DIR)\"
|
|
||||||
CXXFLAGS += -Wall -ansi -pedantic -Werror -Wstrict-prototypes
|
|
||||||
CXXFLAGS += -g -lefence
|
|
||||||
|
|
||||||
LIBS := `sdl2-config --libs` -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lm
|
|
||||||
|
|
||||||
SEARCHPATH += src/ src/battle src/draw src/game src/galaxy src/json src/system src/test
|
SEARCHPATH += src/ src/battle src/draw src/game src/galaxy src/json src/system src/test
|
||||||
vpath %.c $(SEARCHPATH)
|
vpath %.c $(SEARCHPATH)
|
||||||
vpath %.h $(SEARCHPATH)
|
vpath %.h $(SEARCHPATH)
|
||||||
|
@ -37,46 +27,13 @@ OBJS += testMission.o textures.o text.o title.o transition.o
|
||||||
OBJS += util.o
|
OBJS += util.o
|
||||||
OBJS += waypoints.o widgets.o
|
OBJS += waypoints.o widgets.o
|
||||||
|
|
||||||
DIST_FILES = data gfx manual music sound src LICENSE makefile* common.mk README.md CHANGELOG
|
|
||||||
|
|
||||||
# top-level rule to create the program.
|
# top-level rule to create the program.
|
||||||
all: $(TARGET)
|
all: $(PROG)
|
||||||
|
|
||||||
# compiling other source files.
|
# compiling other source files.
|
||||||
%.o: %.c %.h $(DEPS)
|
%.o: %.c %.h $(DEPS)
|
||||||
$(CC) $(CFLAGS) $(CXXFLAGS) -c $<
|
$(CC) $(CFLAGS) $(CXXFLAGS) -c $<
|
||||||
|
|
||||||
# linking the program.
|
|
||||||
$(TARGET): $(OBJS)
|
|
||||||
$(CC) -o $@ $(OBJS) $(LIBS)
|
|
||||||
|
|
||||||
install:
|
|
||||||
cp $(TARGET) $(BIN_DIR)
|
|
||||||
mkdir -p $(DATA_DIR)
|
|
||||||
cp -r data $(DATA_DIR)
|
|
||||||
cp -r gfx $(DATA_DIR)
|
|
||||||
cp -r manual $(DATA_DIR)
|
|
||||||
cp -r music $(DATA_DIR)
|
|
||||||
cp -r sound $(DATA_DIR)
|
|
||||||
|
|
||||||
uninstall:
|
|
||||||
$(RM) $(BIN_DIR)/$(TARGET)
|
|
||||||
$(RM) -rf $(DATA_DIR)
|
|
||||||
|
|
||||||
# prepare an archive for the program
|
|
||||||
dist:
|
|
||||||
$(RM) -rf $(PROG)-$(VERSION)
|
|
||||||
mkdir $(PROG)-$(VERSION)
|
|
||||||
cp -r $(DIST_FILES) $(PROG)-$(VERSION)
|
|
||||||
git log --oneline --decorate >$(PROG)-$(VERSION)/CHANGELOG.raw
|
|
||||||
tar czf $(PROG)-$(VERSION)-$(REVISION).src.tar.gz $(PROG)-$(VERSION)
|
|
||||||
mkdir -p dist
|
|
||||||
$(RM) -rf dist/*
|
|
||||||
mv $(PROG)-$(VERSION)-$(REVISION).src.tar.gz dist
|
|
||||||
$(RM) -rf $(PROG)-$(VERSION)
|
|
||||||
|
|
||||||
# cleaning everything that can be automatically recreated with "make".
|
# cleaning everything that can be automatically recreated with "make".
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(OBJS) $(TARGET)
|
$(RM) $(OBJS) $(PROG)
|
||||||
|
|
||||||
.PHONY: dist
|
|
||||||
|
|
41
makefile
41
makefile
|
@ -1,5 +1,5 @@
|
||||||
|
PROG = tbftss
|
||||||
CC = gcc
|
CC = gcc
|
||||||
EXEEXT =
|
|
||||||
BIN_DIR = /usr/bin
|
BIN_DIR = /usr/bin
|
||||||
DATA_DIR = /opt/tbftss
|
DATA_DIR = /opt/tbftss
|
||||||
|
|
||||||
|
@ -7,3 +7,42 @@ SEARCHPATH += src/plat/unix
|
||||||
OBJS += unixInit.o
|
OBJS += unixInit.o
|
||||||
|
|
||||||
include common.mk
|
include common.mk
|
||||||
|
|
||||||
|
CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDEBUG=$(DEBUG) -DDATA_DIR=\"$(DATA_DIR)\"
|
||||||
|
CXXFLAGS += -Wall -ansi -pedantic -Werror -Wstrict-prototypes
|
||||||
|
CXXFLAGS += -g -lefence
|
||||||
|
|
||||||
|
LFLAGS := `sdl2-config --libs` -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lm
|
||||||
|
|
||||||
|
DIST_FILES = data gfx manual music sound src LICENSE makefile* common.mk README.md CHANGELOG
|
||||||
|
|
||||||
|
# linking the program.
|
||||||
|
$(PROG): $(OBJS)
|
||||||
|
$(CC) -o $@ $(OBJS) $(LFLAGS)
|
||||||
|
|
||||||
|
install:
|
||||||
|
cp $(PROG) $(BIN_DIR)
|
||||||
|
mkdir -p $(DATA_DIR)
|
||||||
|
cp -r data $(DATA_DIR)
|
||||||
|
cp -r gfx $(DATA_DIR)
|
||||||
|
cp -r manual $(DATA_DIR)
|
||||||
|
cp -r music $(DATA_DIR)
|
||||||
|
cp -r sound $(DATA_DIR)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
$(RM) $(BIN_DIR)/$(PROG)
|
||||||
|
$(RM) -rf $(DATA_DIR)
|
||||||
|
|
||||||
|
# prepare an archive for the program
|
||||||
|
dist:
|
||||||
|
$(RM) -rf $(PROG)-$(VERSION)
|
||||||
|
mkdir $(PROG)-$(VERSION)
|
||||||
|
cp -r $(DIST_FILES) $(PROG)-$(VERSION)
|
||||||
|
git log --oneline --decorate >$(PROG)-$(VERSION)/CHANGELOG.raw
|
||||||
|
tar czf $(PROG)-$(VERSION)-$(REVISION).src.tar.gz $(PROG)-$(VERSION)
|
||||||
|
mkdir -p dist
|
||||||
|
$(RM) -rf dist/*
|
||||||
|
mv $(PROG)-$(VERSION)-$(REVISION).src.tar.gz dist
|
||||||
|
$(RM) -rf $(PROG)-$(VERSION)
|
||||||
|
|
||||||
|
.PHONY: dist
|
||||||
|
|
|
@ -1,7 +1,19 @@
|
||||||
EXEEXT = .exe
|
PROG = tbftss.exe
|
||||||
CC = x86_64-w64-mingw32-gcc
|
CC = x86_64-w64-mingw32-gcc
|
||||||
|
SDLC = /usr/x86_64-w64-mingw32/bin/sdl2-config
|
||||||
|
LIBPATH = /usr/x86_64-w64-mingw32/lib
|
||||||
|
|
||||||
SEARCHPATH += src/plat/win32
|
SEARCHPATH += src/plat/win32
|
||||||
OBJS += win32Init.o
|
OBJS += win32Init.o
|
||||||
|
|
||||||
|
CXXFLAGS += `$(SDLC) --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDEBUG=$(DEBUG) -DDATA_DIR=\"$(DATA_DIR)\"
|
||||||
|
CXXFLAGS += -Wall -ansi -pedantic -Werror -Wstrict-prototypes
|
||||||
|
CXXFLAGS += -g -lefence
|
||||||
|
|
||||||
|
LFLAGS = `$(SDLC) --libs` -lm -lSDL2_mixer -lSDL2_image -lSDL2_ttf -lSDL2main
|
||||||
|
|
||||||
include common.mk
|
include common.mk
|
||||||
|
|
||||||
|
# linking the program.
|
||||||
|
$(PROG): $(OBJS)
|
||||||
|
$(CC) -o $@ $(OBJS) $(LFLAGS) -L$(LIBPATH)
|
||||||
|
|
Loading…
Reference in New Issue