| 1 |
############################################################################### |
| 2 |
# Free42 -- an HP-42S calculator simulator |
| 3 |
# Copyright (C) 2004-2026 Thomas Okken |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License, version 2, |
| 7 |
# as published by the Free Software Foundation. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program; if not, see http://www.gnu.org/licenses/. |
| 16 |
############################################################################### |
| 17 |
|
| 18 |
PKG_CONFIG ?= pkg-config |
| 19 |
CXX_FOR_BUILD ?= $(CXX) |
| 20 |
|
| 21 |
CFLAGS += -MMD \ |
| 22 |
-Wall \ |
| 23 |
-Wno-parentheses \ |
| 24 |
-Wno-sign-compare \ |
| 25 |
-Wno-format-truncation \ |
| 26 |
-Wno-unknown-warning-option \ |
| 27 |
-Wno-unknown-pragmas \ |
| 28 |
-g \ |
| 29 |
$(shell $(PKG_CONFIG) --cflags gtk+-3.0) \ |
| 30 |
-DGDK_DISABLE_DEPRECATION_WARNINGS -DGTK_DISABLE_SINGLE_INCLUDES -DGSEAL_ENABLE \ |
| 31 |
-DVERSION="\"$(shell cat VERSION)\"" \ |
| 32 |
-DVERSION_PLATFORM="\"$(shell uname -s)\"" \ |
| 33 |
-DDECIMAL_CALL_BY_REFERENCE=1 \ |
| 34 |
-DDECIMAL_GLOBAL_ROUNDING=1 \ |
| 35 |
-DDECIMAL_GLOBAL_ROUNDING_ACCESS_FUNCTIONS=1 \ |
| 36 |
-DDECIMAL_GLOBAL_EXCEPTION_FLAGS=1 \ |
| 37 |
-DDECIMAL_GLOBAL_EXCEPTION_FLAGS_ACCESS_FUNCTIONS=1 \ |
| 38 |
-DHAVE_SINCOS=1 |
| 39 |
|
| 40 |
CXXFLAGS = $(CFLAGS) \ |
| 41 |
-fno-exceptions \ |
| 42 |
-fno-rtti \ |
| 43 |
-D_WCHAR_T_DEFINED |
| 44 |
|
| •45 |
LIBS = -lbidgcc111 $(shell $(PKG_CONFIG) --libs gtk+-3.0) |
| 46 |
|
| 47 |
ifdef AUDIO_ALSA |
| 48 |
LIBS += -lpthread -ldl |
| 49 |
endif |
| 50 |
|
| 51 |
ifneq "$(findstring 6162,$(shell echo ab | od -x))" "" |
| 52 |
CFLAGS += -DF42_BIG_ENDIAN -DBID_BIG_ENDIAN |
| 53 |
endif |
| 54 |
|
| 55 |
ifeq "$(shell uname -m)" "arm64" |
| 56 |
CFLAGS += -fsigned-char -DBID_SIZE_LONG=8 |
| 57 |
else ifeq "$(shell uname -m)" "aarch64" |
| 58 |
CFLAGS += -fsigned-char -DBID_SIZE_LONG=8 |
| 59 |
else ifeq "$(shell uname -m | sed 's/^\(...\).*$$/\1/')" "arm" |
| 60 |
CFLAGS += -fsigned-char -DBID_SIZE_LONG=4 |
| 61 |
endif |
| 62 |
|
| 63 |
SRCS = shell_main.cc shell_skin.cc skins.cc keymap.cc shell_loadimage.cc \ |
| 64 |
shell_spool.cc core_main.cc core_commands1.cc core_commands2.cc \ |
| 65 |
core_commands3.cc core_commands4.cc core_commands5.cc \ |
| 66 |
core_commands6.cc core_commands7.cc core_display.cc core_globals.cc \ |
| 67 |
core_helpers.cc core_keydown.cc core_linalg1.cc core_linalg2.cc \ |
| 68 |
core_math1.cc core_math2.cc core_phloat.cc core_sto_rcl.cc \ |
| 69 |
core_tables.cc core_variables.cc |
| 70 |
CORE_OBJS = shell_spool.o core_main.o core_commands1.o core_commands2.o \ |
| 71 |
core_commands3.o core_commands4.o core_commands5.o \ |
| 72 |
core_commands6.o core_commands7.o core_display.o core_globals.o \ |
| 73 |
core_helpers.o core_keydown.o core_linalg1.o core_linalg2.o \ |
| 74 |
core_math1.o core_math2.o core_phloat.o core_sto_rcl.o \ |
| 75 |
core_tables.o core_variables.o |
| 76 |
OBJS = shell_main.o shell_skin.o skins.o keymap.o shell_loadimage.o \ |
| 77 |
$(CORE_OBJS) |
| 78 |
|
| 79 |
ifdef BCD_MATH |
| 80 |
CXXFLAGS += -DBCD_MATH |
| 81 |
EXE = free42dec |
| 82 |
else |
| 83 |
EXE = free42bin |
| 84 |
endif |
| 85 |
|
| 86 |
ifdef FREE42_FPTEST |
| 87 |
CFLAGS += -DFREE42_FPTEST |
| 88 |
SRCS += readtest.c readtest_lines.cc |
| 89 |
OBJS += readtest.o readtest_lines.o |
| 90 |
endif |
| 91 |
|
| 92 |
ifdef AUDIO_ALSA |
| 93 |
# Note: the name of the libasound shared library that is usually compiled into |
| 94 |
# the executable is defined in the corresponding *.la file, in the 'dlname' |
| 95 |
# property. I suppose it would be better to grab it from there at build time, |
| 96 |
# rather than hard-coding it into the Makefile like this, but as long as the |
| 97 |
# build environment doesn't change (currently Ubuntu 16.04), this is fine. |
| 98 |
CXXFLAGS += -DAUDIO_ALSA -DALSALIB="\"libasound.so.2\"" |
| 99 |
SRCS += audio_alsa.cc |
| 100 |
OBJS += audio_alsa.o |
| 101 |
endif |
| 102 |
|
| •103 |
$(EXE): $(OBJS) icons.o |
| 104 |
$(CXX) -o $(EXE) $(LDFLAGS) $(OBJS) icons.o $(LIBS) |
| 105 |
|
| •106 |
txt2raw: symlinks txt2raw.o $(CORE_OBJS) |
| 107 |
$(CXX) -o txt2raw $(LDFLAGS) txt2raw.o $(CORE_OBJS) $(LIBS) |
| 108 |
|
| •109 |
raw2txt: symlinks raw2txt.o $(CORE_OBJS) |
| 110 |
$(CXX) -o raw2txt $(LDFLAGS) raw2txt.o $(CORE_OBJS) $(LIBS) |
| 111 |
|
| 112 |
$(SRCS) skin2cc.cc keymap2cc.cc skin2cc.conf: symlinks |
| 113 |
|
| 114 |
.cc.o: |
| 115 |
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< |
| 116 |
|
| 117 |
icons.o: icons.gresource.xml |
| 118 |
glib-compile-resources --generate-source $< |
| 119 |
$(CC) $(CFLAGS) -c -o $@ icons.c |
| 120 |
rm icons.c |
| 121 |
|
| 122 |
readtest.o: readtest.c |
| 123 |
$(CC) $(CFLAGS) -I IntelRDFPMathLib20U1/TESTS -D__intptr_t_defined -DLINUX -c -o $@ $< |
| 124 |
|
| 125 |
skin2cc: skin2cc.cc |
| 126 |
$(CXX_FOR_BUILD) -o skin2cc skin2cc.cc |
| 127 |
|
| 128 |
skins.cc: skin2cc skin2cc.conf |
| 129 |
./skin2cc |
| 130 |
|
| 131 |
keymap2cc: keymap2cc.cc |
| 132 |
$(CXX_FOR_BUILD) -o keymap2cc keymap2cc.cc |
| 133 |
|
| 134 |
keymap.cc: keymap2cc keymap.txt |
| 135 |
./keymap2cc |
| 136 |
|
| 137 |
symlinks: |
| 138 |
for fn in `cd ../common; /bin/ls`; do ln -s ../common/$$fn; done |
| 139 |
touch symlinks |
| 140 |
|
| 141 |
clean: FORCE |
| 142 |
rm -f `find . -type l ! -name readtest.c` \ |
| 143 |
skin2cc skin2cc.exe skins.cc \ |
| 144 |
keymap2cc keymap2cc.exe keymap.cc \ |
| 145 |
*.o *.d *.i *.ii *.s symlinks core.* \ |
| 146 |
raw2txt txt2raw |
| 147 |
|
| 148 |
cleaner: FORCE |
| 149 |
rm -f `find . -type l` \ |
| 150 |
free42bin free42bin.exe free42dec free42dec.exe \ |
| 151 |
skin2cc skin2cc.exe skins.cc \ |
| 152 |
keymap2cc keymap2cc.exe keymap.cc \ |
| 153 |
readtest_lines.cc \ |
| 154 |
*.o *.d *.i *.ii *.s symlinks core.* \ |
| 155 |
raw2txt txt2raw |
| 156 |
rm -rf IntelRDFPMathLib20U1 |
| 157 |
|
| 158 |
FORCE: |
| 159 |
|
| 160 |
-include $(OBJS:.o=.d) |