Skip to content

Commit 8f506c9

Browse files
authored
Merge pull request #107 from mike632t/unstable
Merged changes for build 0154
2 parents b054bc3 + 7d816ed commit 8f506c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+575
-416
lines changed

README.md

Lines changed: 268 additions & 163 deletions
Large diffs are not rendered by default.

makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@
9898
# environment if neither 'prefix' or 'DESTDIR' are set
9999
# by the user - MT
100100
# 09 Apr 24 - Optimized install script - MT
101+
# 24 Apr 24 - Fix parallel make with .NOTPARALLEL accross models
102+
# in top makefile to prevent concurrent compiles of
103+
# same common files. Make is still parallelizing
104+
# submakes calls which do the real work. - macmpi
105+
# 29 Apr 24 - Improve parallel make performance - macmpi
101106
#
102107

103108
PROGRAM = x11-calc
@@ -110,7 +115,7 @@ IMG = img
110115

111116
# Files to be backed up (and the current date).
112117

113-
_files = `ls makefile makefile.*.[0-9] $(SRC)/makefile $(SRC)/makefile.common $(SRC)/makefile.linux $(SRC)/makefile.bsd $(SRC)/makefile.osf1 $(SRC)/makefile.*.[0-9] 2>/dev/null || true`
118+
_files = `ls makefile makefile.*.[0-9] $(SRC)/makefile $(SRC)/makefile.all $(SRC)/makefile.linux $(SRC)/makefile.bsd $(SRC)/makefile.osf1 $(SRC)/makefile.*.[0-9] 2>/dev/null || true`
114119
_source = `ls $(SRC)/*.c $(SRC)/*.c.[0-9] $(SRC)/*.h $(SRC)/*.h.[0-9] $(SRC)/*.in $(SRC)/*.in.[0-9] 2>/dev/null || true`
115120
_data = `ls $(ROM)/$(PROGRAM)*.rom $(ROM)/$(PROGRAM)*.rom.[0-9] $(PRG)/$(PROGRAM)*.dat $(PRG)/$(PROGRAM)*.dat.[0-9] 2>/dev/null || true`
116121
_images = `ls $(SRC)/*.ico $(SRC)/*.ico.[0-9] $(SRC)/*.png $(SRC)/*.png.[0-9] $(SRC)/*.svg $(SRC)/*.svg.[0-9] $(IMG)/*.png $(IMG)/*.png.[0-9] 2>/dev/null || true`
@@ -153,12 +158,15 @@ spice: $(_spice) $(PROGRAM)
153158

154159
voyager: $(_voyager) $(PROGRAM)
155160

156-
# Base pre-model compile target:
157-
.DEFAULT:
161+
# Base per-model compile target:
162+
$(MODELS): common
158163
@_model="`echo "$@" | sed 's/hp//'`"; \
159164
cd $(SRC); \
160165
$(MAKE) -s MODEL=$$_model all
161166

167+
common:
168+
@cd $(SRC); $(MAKE) -s common
169+
162170
$(PROGRAM): $(BIN)/$(PROGRAM)
163171

164172
$(BIN)/$(PROGRAM): $(SRC)/$(PROGRAM).in
@@ -184,7 +192,6 @@ install:
184192
# Note that Tru64 requires both DESTDIR and prefix to be explicitly defined
185193
# when invoking make.
186194
#
187-
188195
@_unset() { if [ -z "$(DESTDIR)$(prefix)" ]; then return 0; else return 1; fi;}; \
189196
_desktop="`echo "$(DESKTOP)" | tr '[:lower:]' '[:upper:]' `"; \
190197
if [ -z "$$_desktop" ]; then \

src/gcc-exists.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
* You should have received a copy of the GNU General Public License along
1919
* with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*
21-
* 06 Jul 20 0.1 - Initial version - MT
22-
* 0.2 - Added exists() - MT
21+
* 06 Jul 20 - Initial version - MT
22+
* - Added exists() - MT
23+
* 22 Apr 24 - Tidied up function prototypes - MT
2324
*
2425
*/
2526

26-
int i_isfile(char *_name);
27+
int i_isfile(const char *_name);
2728

28-
int i_isdir(char *_name);
29+
int i_isdir(const char *_name);
2930

30-
int i_exists(char *_name);
31+
int i_exists(const char *_name);

src/gcc-wait.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
* need to include stdio.h - MT
3434
* 27 Feb 24 - Fixed busy loop 'bug' on newer compilers that do not
3535
* set 'linux' when compiling on Linux - MT
36+
* 22 Apr 22 - Moved compiler feature macro definitions to generic
37+
* busy loop - MT
3638
*
3739
*/
3840

@@ -41,9 +43,6 @@
4143
#define DATE "07 Feb 24"
4244
#define AUTHOR "MT"
4345

44-
#define _DEFAULT_SOURCE
45-
#define _BSD_SOURCE
46-
4746
#if defined(linux) || defined(__linux__) || defined(__NetBSD__)
4847
#include <unistd.h>
4948
#include <sys/types.h>
@@ -74,6 +73,8 @@ float f_seconds;
7473
f_seconds = l_delay / 1000.0;
7574
return (lib$wait(&f_seconds)); /* Use VMS LIB$WAIT */
7675
#else
76+
/** #define _DEFAULT_SOURCE /* Possibly required for busy loop more testing needed */
77+
/** #define _BSD_SOURCE /* Possibly required for busy loop more testing needed */
7778
struct timeb o_start, o_end;
7879
ftime(&o_start);
7980
ftime(&o_end);

src/makefile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@
2626
# 29 Mar 24 - Use linux/bsd/osf1 makefiles -macmpi
2727
#
2828

29-
MODEL = 21
29+
MODEL = 21
3030

3131
all:
32-
@_flavor="`uname -s | tr '[:upper:]' '[:lower:]'`"; \
33-
echo "$$_flavor" | grep -qwE "netbsd|darwin" && _flavor=bsd; \
34-
$(MAKE) -f "makefile.$$_flavor" MODEL=$(MODEL) $@
35-
36-
clean:
37-
@_flavor="`uname -s | tr '[:upper:]' '[:lower:]'`"; \
38-
echo "$$_flavor" | grep -qwE "netbsd|darwin" && _flavor=bsd; \
39-
$(MAKE) -f "makefile.$$_flavor" MODEL=$(MODEL) $@
32+
@_os="`uname -s | tr '[:upper:]' '[:lower:]'`"; \
33+
echo "$$_os" | grep -qwE "freebsd|netbsd|darwin" && _os=bsd; \
34+
$(MAKE) -s -f "makefile.$$_os" MODEL=$(MODEL) $@
4035

36+
.DEFAULT:
37+
@_os="`uname -s | tr '[:upper:]' '[:lower:]'`"; \
38+
echo "$$_os" | grep -qwE "freebsd|netbsd|darwin" && _os=bsd; \
39+
$(MAKE) -s -f "makefile.$$_os" MODEL=$(MODEL) $@

src/makefile.common renamed to src/makefile.all

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# makefile.generic - RPN (Reverse Polish) calculator simulator.
2+
# makefile.all_flavors - RPN (Reverse Polish) calculator simulator.
33
#
44
# Copyright(C) 2024 - macmpi, MT
55
#
@@ -28,28 +28,30 @@
2828
# 28 Mar 24 - Streamlined macros for use on osf1 - macmpi
2929
# 09 Apr 24 - Finally renamed x11-calc-segment to the more correct
3030
# x11-calc-digit - MT
31+
# 29 Apr 24 - renamed makefile.all_flavors - macmpi
32+
# - renamed makefile.all - MT
3133
#
3234

33-
MODEL = 21
34-
PROGRAM = x11-calc-$(MODEL)
35+
MODEL = 21
36+
PROGRAM = x11-calc-$(MODEL)
3537
BIN = ../bin
3638

3739
# SHARED sources are model-dependant via HP$(MODEL) #define statements
38-
SHARED = x11-calc.c x11-calc-cpu.c x11-calc-display.c x11-calc-digit.c x11-calc-messages.c x11-calc-button.c
39-
COMMON = x11-calc-switch.c x11-calc-label.c x11-calc-colour.c x11-calc-font.c x11-keyboard.c gcc-wait.c gcc-exists.c
40+
SHARED = x11-calc.c x11-calc-cpu.c x11-calc-display.c x11-calc-digit.c x11-calc-messages.c x11-calc-button.c
41+
COMMON = x11-calc-switch.c x11-calc-label.c x11-calc-colour.c x11-calc-font.c x11-keyboard.c gcc-wait.c gcc-exists.c
4042

4143
CC = cc
4244
DEBUG =
4345

4446
LDLIBS_ADD = -lX11 -lm
4547

4648
CFLAGS_ADD = -fcommon -Wall -pedantic -std=gnu99 \
47-
-Wno-comment -Wno-deprecated-declarations -Wno-builtin-macro-redefined \
48-
-D$(LANG) $(DEBUG)
49+
-Wno-comment -Wno-deprecated-declarations -Wno-builtin-macro-redefined \
50+
-D$(LANG) $(DEBUG)
4951

5052
all: $(BIN)/$(PROGRAM)
5153

52-
$(BIN)/$(PROGRAM): $(SHARED:.c=.o_HP$(MODEL)) $(COMMON:.c=.o_cm) x11-calc-$(MODEL).o
54+
$(BIN)/$(PROGRAM): common $(SHARED:.c=.o_HP$(MODEL)) x11-calc-$(MODEL).o
5355
@mkdir -p $(BIN)
5456
@rm -f $(BIN)/$(PROGRAM)
5557
@[ -n "$${VERBOSE+x}" ] && echo && \
@@ -58,7 +60,9 @@ $(BIN)/$(PROGRAM): $(SHARED:.c=.o_HP$(MODEL)) $(COMMON:.c=.o_cm) x11-calc-$(MODE
5860
@$(CC) $(SHARED:.c=.o_HP$(MODEL)) $(COMMON:.c=.o_cm) x11-calc-$(MODEL).o $(LDFLAGS) $(LDLIBS) $(LDLIBS_ADD) -o $@
5961
@ls $@ | sed "s:$(BIN)/::g"
6062

61-
.SUFFIXES: .o_HP$(MODEL) .o_cm .o
63+
common: $(COMMON:.c=.o_cm)
64+
65+
.SUFFIXES: .o_cm .o_HP$(MODEL) .o
6266

6367
.c.o_HP$(MODEL):
6468
@[ -n "$${VERBOSE+x}" ] && echo && echo "$(CC) $(CFLAGS) $(CFLAGS_ADD) -DHP$(MODEL) -c $< -o $@" || true
@@ -68,10 +72,10 @@ $(BIN)/$(PROGRAM): $(SHARED:.c=.o_HP$(MODEL)) $(COMMON:.c=.o_cm) x11-calc-$(MODE
6872
@[ -n "$${VERBOSE+x}" ] && echo && echo "$(CC) $(CFLAGS) $(CFLAGS_ADD) -DHP$(MODEL) -c $< -o $@" || true
6973
@$(CC) $(CFLAGS) $(CFLAGS_ADD) -DHP$(MODEL) -c $< -o $@
7074

71-
# COMMON files are NOT supposed to be instanciated per MODEL (will fix soon)
75+
# COMMON files are NOT supposed to be instanciated per MODEL
7276
.c.o_cm:
73-
@[ -n "$${VERBOSE+x}" ] && echo && echo "$(CC) $(CFLAGS) $(CFLAGS_ADD) -DHP$(MODEL) -c $< -o $@" || true
74-
@$(CC) $(CFLAGS) $(CFLAGS_ADD) -DHP$(MODEL) -c $< -o $@
77+
@[ -n "$${VERBOSE+x}" ] && echo && echo "$(CC) $(CFLAGS) $(CFLAGS_ADD) -c $< -o $@" || true
78+
@$(CC) $(CFLAGS) $(CFLAGS_ADD) -c $< -o $@
7579

7680
clean:
7781
@rm -f $(SHARED:.c=.o_HP$(MODEL)) $(COMMON:.c=.o_cm) x11-calc-$(MODEL).o

src/makefile.bsd

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html
2626
#
2727
# 28 Mar 24 - Initial version - macmpi
28+
# 06 May 24 - Fixed include path for Darwin - MT
2829
#
2930

3031
CFLAGS ?=
@@ -34,6 +35,14 @@ LDLIBS ?=
3435
OS != uname -s
3536

3637
# Operating system specific settings
38+
.if ${OS} == "FreeBSD"
39+
LANG = LANG_en
40+
LDLIBS += -lcompat
41+
CFLAGS += -Wno-variadic-macros
42+
CFLAGS += -I/usr/local/include/
43+
LDFLAGS += -L/usr/local/lib/
44+
.endif
45+
3746
.if ${OS} == "NetBSD"
3847
LANG = LANG_en
3948
LDLIBS += -lcompat
@@ -44,8 +53,8 @@ LDFLAGS += -L/usr/X11R7/lib/ -R /usr/X11R7/lib
4453

4554
.if ${OS} == "Darwin" # MacOS
4655
LANG = LANG_en
47-
CFLAGS += -I/opt/X11/include/X11/
56+
CFLAGS += -I/opt/X11/include/
4857
LDFLAGS += -L/opt/X11/lib/
4958
.endif
5059

51-
include makefile.common
60+
include makefile.all

src/makefile.linux

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,16 @@ LDFLAGS ?=
8686
LDLIBS ?=
8787

8888
LANG = LANG_$(shell (echo $$LANG | cut -f 1 -d '_'))
89-
9089
COMMIT != git log -1 HEAD --format=%h 2> /dev/null
9190

9291
ifneq ($(COMMIT),)
93-
CFLAGS += -DCOMMIT_ID='"[Commit Id : $(COMMIT)]"'
92+
CFLAGS += -DCOMMIT_ID='"[Commit Id : $(COMMIT)]"'
9493
endif
9594
ifneq ($(SCALE_WIDTH),)
96-
CFLAGS += -DSCALE_WIDTH=$(SCALE_WIDTH)
95+
CFLAGS += -DSCALE_WIDTH=$(SCALE_WIDTH)
9796
endif
9897
ifneq ($(SCALE_HEIGHT),)
99-
CFLAGS += -DSCALE_HEIGHT=$(SCALE_HEIGHT)
98+
CFLAGS += -DSCALE_HEIGHT=$(SCALE_HEIGHT)
10099
endif
101100

102-
include makefile.common
101+
include makefile.all

src/makefile.osf1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ CFLAGS =
4242
LDFLAGS =
4343
LDLIBS =
4444

45-
include makefile.common
45+
include makefile.all

src/x11-calc-10c.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* 12 Mar 22 - Added the label state property - MT
2626
* 22 May 22 - Fixed shortcut key for SST - MT
2727
* 18 Mar 24 - Embedded firmware - MT
28+
* 22 Apr 24 - Removed duplicate definition - MT
2829
*
2930
* TO DO : -
3031
*/
@@ -55,8 +56,6 @@
5556

5657
oregister o_mem[MEMORY_SIZE];
5758

58-
int i_rom[ROM_SIZE];
59-
6059
void v_init_labels(olabel *h_label[]) {
6160
int i_height = h_small_font->ascent + h_small_font->descent;
6261
h_label[0] = h_label_create(001, "CLEAR" , h_alternate_font, KBD_LEFT + 2 * (KEY_WIDTH + KEY_GAP),

0 commit comments

Comments
 (0)