<commit_before># Makefile for rpn.
# Should be fairly portable for the various *nix systems. The rules
# themselves shouldn't need to be changed; only the variables may need to
# change.

# Automatically default to a release build.
ifndef DEBUG
RELEASE = 1
endif

# Version
VERSION = $(shell cat VERSION)
GIT_BUILD = $(shell git describe)

# Programs
MKF = make -f
CC  = gcc
RM  = rm -f
CP  = cp

# object code
SRCDIR = src/
OBJDIR = obj/generic/
SOURCES = src/console/arguments.c src/calculator.c src/commands.c \
          src/console/error.c src/console/help.c src/history.c src/operators.c \
          src/parser.c src/console/main.c src/stack.c src/tokens.c \
          src/variables.c
OBJECTS = $(subst .c,.o,$(subst $(SRCDIR),$(OBJDIR),$(SOURCES)))

# Git command to make a distribution tarball.
GIT_ARCHIVE = git archive --format=tar --prefix=rpn-$(VERSION)/ HEAD | \
	bzip2 >rpn-$(VERSION).tar.bz2

# Installation directory
INSTALL_DIR = /usr/bin

# Executable generation directory
BIN_DIR = bin/generic

# Compilation options
ifdef RELEASE
CFLAGS = -c -s -Wall -O2 -DRPN_CONSOLE -DRPN_LONG_DOUBLE -D_GNU_SOURCE \
         -DHASH_FUNCTION=HASH_JSW -DGIT_BUILD="\"$(GIT_BUILD)\"" -Isrc/include -o
LFLAGS = -s -lm -o
endif
ifdef DEBUG
CFLAGS = -c -Wall -g -DRPN_CONSOLE -DRPN_LONG_DOUBLE -DRPN_DEBUG -D_GNU_SOURCE \
         -DHASH_FUNCTION=HASH_JSW -DGIT_BUILD="\"$(GIT_BUILD)\"" -Isrc/include -o
LFLAGS = -lm -o
endif
TARGET = $(BIN_DIR)/rpn

# General rule for compiling.
$(OBJDIR)%.o: $(SRCDIR)%.c
	@echo Compiling $(notdir $<)
	@$(CC) $< $(CFLAGS) $@

# rule to make the program
$(TARGET): $(OBJECTS)
	@echo Linking $(TARGET)...
	@$(CC) $(OBJECTS) $(LFLAGS) $@

# make the program by default
.PHONY: all
all: $(TARGET)

# rule to clean-up the objects and the target, if they exist
.PHONY: clean
clean:
	@echo Cleaning objects and executables...
	@$(RM) $(OBJECTS)
	@$(RM) $(TARGET)

# rule to install program
.PHONY: install
install: $(TARGET)
	$(CP) $< $(INSTALL_DIR)

# rule to make tarball for distribution.
.PHONY: dist
dist:
	$(GIT_ARCHIVE)

# rule to make documentation
.PHONY: doc
doc:
	doxygen Doxyfile

# PSP compilation.
PSP_TARGET  = EBOOT.PBP
PSP_MAKEFILE = Makefile.psp

# Call the PSP makefile to do the work.
$(PSP_TARGET): $(PSP_MAKEFILE)
	@$(MKF) $<

# Make the executable.
.PHONY: psp
psp: $(PSP_TARGET)

# Cleanup.
.PHONY: psp-clean
psp-clean:
	@$(MKF) $(PSP_MAKEFILE) clean

.PHONY: psp-install
psp-install:
	@$(MKF) $(PSP_MAKEFILE) install

# Wii compilation.
WII_MAKEFILE = Makefile.wii

.PHONY: wii
wii: $(WII_MAKEFILE)
	@$(MKF) $(WII_MAKEFILE)

.PHONY: wii-clean
wii-clean: $(WII_MAKEFILE)
	@$(MKF) $(WII_MAKEFILE) clean

.PHONY: wii-run
wii-run: $(WII_MAKEFILE)
	@$(MKF) $(WII_MAKEFILE) run

# GUI compilation.
GUI_TARGET = $(BIN_DIR)/rpn-gui
GUI_MAKEFILE = Makefile.gui

$(GUI_TARGET): $(GUI_MAKEFILE)
	@$(MKF) $<

.PHONY: gui
gui: $(GUI_TARGET)

.PHONY: gui-clean
gui-clean:
	@$(MKF) $(GUI_MAKEFILE) clean

.PHONY: love
love:
	@echo Not war?<commit_msg>Fitted Makefile within the 80-column limit.<commit_after># Makefile for rpn.
# Should be fairly portable for the various *nix systems. The rules
# themselves shouldn't need to be changed; only the variables may need to
# change.

# Automatically default to a release build.
ifndef DEBUG
RELEASE = 1
endif

# Version
VERSION = $(shell cat VERSION)
GIT_BUILD = $(shell git describe)

# Programs
MKF = make -f
CC  = gcc
RM  = rm -f
CP  = cp

# object code
SRCDIR = src/
OBJDIR = obj/generic/
SOURCES = src/console/arguments.c src/calculator.c src/commands.c \
          src/console/error.c src/console/help.c src/history.c src/operators.c \
          src/parser.c src/console/main.c src/stack.c src/tokens.c \
          src/variables.c
OBJECTS = $(subst .c,.o,$(subst $(SRCDIR),$(OBJDIR),$(SOURCES)))

# Git command to make a distribution tarball.
GIT_ARCHIVE = git archive --format=tar --prefix=rpn-$(VERSION)/ HEAD | \
	bzip2 >rpn-$(VERSION).tar.bz2

# Installation directory
INSTALL_DIR = /usr/bin

# Executable generation directory
BIN_DIR = bin/generic

# Compilation options
ifdef RELEASE
CFLAGS = -c -s -Wall -O2 -DRPN_CONSOLE -DRPN_LONG_DOUBLE -D_GNU_SOURCE \
         -DHASH_FUNCTION=HASH_JSW -DGIT_BUILD="\"$(GIT_BUILD)\"" -Isrc/include \
         -o
LFLAGS = -s -lm -o
endif
ifdef DEBUG
CFLAGS = -c -Wall -g -DRPN_CONSOLE -DRPN_LONG_DOUBLE -DRPN_DEBUG -D_GNU_SOURCE \
         -DHASH_FUNCTION=HASH_JSW -DGIT_BUILD="\"$(GIT_BUILD)\"" -Isrc/include \
         -o
LFLAGS = -lm -o
endif
TARGET = $(BIN_DIR)/rpn

# General rule for compiling.
$(OBJDIR)%.o: $(SRCDIR)%.c
	@echo Compiling $(notdir $<)
	@$(CC) $< $(CFLAGS) $@

# rule to make the program
$(TARGET): $(OBJECTS)
	@echo Linking $(TARGET)...
	@$(CC) $(OBJECTS) $(LFLAGS) $@

# make the program by default
.PHONY: all
all: $(TARGET)

# rule to clean-up the objects and the target, if they exist
.PHONY: clean
clean:
	@echo Cleaning objects and executables...
	@$(RM) $(OBJECTS)
	@$(RM) $(TARGET)

# rule to install program
.PHONY: install
install: $(TARGET)
	$(CP) $< $(INSTALL_DIR)

# rule to make tarball for distribution.
.PHONY: dist
dist:
	$(GIT_ARCHIVE)

# rule to make documentation
.PHONY: doc
doc:
	doxygen Doxyfile

# PSP compilation.
PSP_TARGET  = EBOOT.PBP
PSP_MAKEFILE = Makefile.psp

# Call the PSP makefile to do the work.
$(PSP_TARGET): $(PSP_MAKEFILE)
	@$(MKF) $<

# Make the executable.
.PHONY: psp
psp: $(PSP_TARGET)

# Cleanup.
.PHONY: psp-clean
psp-clean:
	@$(MKF) $(PSP_MAKEFILE) clean

.PHONY: psp-install
psp-install:
	@$(MKF) $(PSP_MAKEFILE) install

# Wii compilation.
WII_MAKEFILE = Makefile.wii

.PHONY: wii
wii: $(WII_MAKEFILE)
	@$(MKF) $(WII_MAKEFILE)

.PHONY: wii-clean
wii-clean: $(WII_MAKEFILE)
	@$(MKF) $(WII_MAKEFILE) clean

.PHONY: wii-run
wii-run: $(WII_MAKEFILE)
	@$(MKF) $(WII_MAKEFILE) run

# GUI compilation.
GUI_TARGET = $(BIN_DIR)/rpn-gui
GUI_MAKEFILE = Makefile.gui

$(GUI_TARGET): $(GUI_MAKEFILE)
	@$(MKF) $<

.PHONY: gui
gui: $(GUI_TARGET)

.PHONY: gui-clean
gui-clean:
	@$(MKF) $(GUI_MAKEFILE) clean

# An easter egg, just for the hell of it.
.PHONY: love
love:
	@echo Not war?
{'fraction_non_alphanumeric': 0.14856860809476802, 'fraction_numerical': 0.0016452780519907865, 'mean_word_length': 3.7529319781078967, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4947844', 'n_tokens_mistral': 2498, 'n_tokens_neox': 2387, 'n_words': 649}