/Makefile (cbeae2f15a147f5e27de93c390949661b24a7d92) (2939 bytes) (mode 100644) (type blob)
ANDROID_SDK=/usr/lib/android-sdk
ANDROID_TOOLS_ZIP=commandlinetools-linux-8092744_latest.zip
PROGRAM=cfps
LINCC := gcc -march=x86-64
WINCC := i686-w64-mingw32-gcc-win32 -march=pentium4
CFLAGS=-std=c99 -Wall -Wextra -Wpedantic -O3
# SDL
SDL_VER=2.30.3
SDL_DIR=SDL2-$(SDL_VER)
SDL_TAR=$(SDL_DIR).tar.gz
SDL_WIN_TAR=SDL2-devel-$(SDL_VER)-mingw.tar.gz
# Object files.
OBJECTS_LIN_DYNAMIC=
OBJECTS_LIN_STATIC=$(OBJECTS_LIN_DYNAMIC) libSDL2.a
# Dynamic libraries.
DYLIBS_LIN_STATIC=-lm -ldl -pthread
DYLIBS_LIN_DYNAMIC=-lSDL2 $(DYLIBS_LIN_STATIC)
# PC stuff.
$(PROGRAM): $(OBJECTS_LIN_DYNAMIC) src/$(PROGRAM).c include/*
# Building for GNU/Linux (dynamic SDL).
$(LINCC) $(CFLAGS) -o $@ -Iinclude src/$(PROGRAM).c $(OBJECTS_LIN_DYNAMIC) -Wl,-rpath,. -L. $(DYLIBS_LIN_DYNAMIC)
$(PROGRAM)-static: $(OBJECTS_LIN_STATIC) src/$(PROGRAM).c include/*
# Building for GNU/Linux (static SDL).
$(LINCC) $(CFLAGS) -o $@ -Iinclude src/$(PROGRAM).c $(OBJECTS_LIN_STATIC) -Wl,-rpath,. -L. $(DYLIBS_LIN_STATIC)
# Android stuff.
android:
PATH="/usr/lib/android-ndk:$PATH" && \
PATH="/usr/lib/android-sdk/tools:$PATH" && \
PATH="/usr/lib/android-sdk/platform-tools:$PATH" && \
export ANDROID_HOME=/usr/lib/android-sdk && \
export ANDROID_SDK_ROOT=$ANDROID_HOME && \
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/21.3.6528147/ && \
cd SDL2-2.0.20/build-scripts && \
./androidbuild.sh com.mse.$(PROGRAM) ../../src/$(PROGRAM).c && \
cd ../build/com.mse.$(PROGRAM) && \
./gradlew --offline --no-rebuild installDebug
# Needs to run as root because apparently phase 2 of the NDK installation happens in this step.
android-deprecated: ccstrap .ndk .license-check
cp -rf include/* SDL2-2.0.20/include/
sudo ./ccstrap
# Needs to run as root because it installs the NDK in the SDK folder.
.ndk: .cmdline-tools
yes | sudo ./cmdline-tools/bin/sdkmanager --sdk_root=$(ANDROID_SDK) --install "ndk;21.3.6528147" --channel=0
touch $@
.license-check: .cmdline-tools
yes | ./cmdline-tools/bin/sdkmanager --sdk_root=$(ANDROID_SDK) --licenses
touch $@
.cmdline-tools: $(ANDROID_TOOLS_ZIP)
unzip $(ANDROID_TOOLS_ZIP)
touch $@
$(ANDROID_TOOLS_ZIP):
wget https://dl.google.com/android/repository/$(ANDROID_TOOLS_ZIP)
# Build SDL2 for Linux as compatibly as possible.
libSDL2.a: $(SDL_DIR)
rm -r -f $(SDL_DIR)/build
mkdir -p $(SDL_DIR)/build
export CC="$(LINCC)" ;\
cd $(SDL_DIR)/build; ../configure --disable-sndio --disable-esd \
--disable-arts --disable-video-directfb --disable-rpath \
--enable-alsa --enable-alsa-shared --enable-pulseaudio \
--enable-pulseaudio-shared --enable-x11-shared --enable-sdl-dlopen \
--disable-input-tslib CFLAGS="-O3" && make
cp $(SDL_DIR)/build/build/.libs/libSDL2.a $@
touch $@
$(SDL_DIR): $(SDL_TAR)
$(RM) -r $@
tar xzvf $(SDL_TAR) $@
touch $@
$(SDL_TAR):
wget https://libsdl.org/release/$(SDL_TAR)
clean:
$(RM) $(PROGRAM) $(PROGRAM)-static
distclean: clean
rm -rf $(OBJECTS_LIN_STATIC) $(SDL_DIR)
Mode |
Type |
Size |
Ref |
File |
100644 |
blob |
38 |
695eda73b280483a65538083a0f72332636c5d3d |
.gitignore |
100644 |
blob |
2939 |
cbeae2f15a147f5e27de93c390949661b24a7d92 |
Makefile |
100644 |
blob |
1751 |
fdf801afc64559c1f28e7541d20fff748ed08ec1 |
README.md |
040000 |
tree |
- |
7b33f439136f67a2e9835bc58e521b412cbfa729 |
base |
040000 |
tree |
- |
3eea0ba020e5b605711b9382499c957c566175fb |
include |
040000 |
tree |
- |
999a394a0d7346bde07840be1390cb1f5dd9cc2b |
src |
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/fluffrabbit/cfps
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/fluffrabbit/cfps
Clone this repository using git:
git clone git://git.rocketgit.com/user/fluffrabbit/cfps
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main