Skip to content

kurt/helios/unified-make-file #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
c2d7510
Added category selection for task creation, allowing users to select …
livingkurt Apr 27, 2025
a787638
Refactor Makefile to streamline build process and add packaging targe…
livingkurt Apr 28, 2025
4261e61
Refactor Makefiles across components to standardize build directories…
livingkurt Apr 28, 2025
89ab663
Fix Makefile to remove unnecessary error suppression and standardize …
livingkurt Apr 28, 2025
3d94d28
Update Makefiles to improve WebAssembly build process and error handl…
livingkurt Apr 28, 2025
111c780
Refactor Makefiles to standardize output directories and improve buil…
livingkurt Apr 28, 2025
6fafb1f
Update Makefile to correct output target for WebAssembly build. Chang…
livingkurt Apr 28, 2025
288d21c
Refactor Makefiles to standardize output directories and improve buil…
livingkurt Apr 30, 2025
563ebb4
Add -MMD flag to Makefile for improved dependency tracking during bui…
livingkurt Apr 30, 2025
daf3ecc
Remove obsolete architecture-specific build directory creation from M…
livingkurt Apr 30, 2025
e2e039c
Moved tests into cli folder
livingkurt Apr 30, 2025
1cb8597
Update .gitignore to include test files and remove obsolete runtests.…
livingkurt Apr 30, 2025
12d9d4d
Fix run_tests.sh script to correctly identify test files and extract …
livingkurt Apr 30, 2025
c8a54e1
Update test scripts to use the correct Helios CLI path and standardiz…
livingkurt Apr 30, 2025
9514e56
Put tests back
livingkurt Apr 30, 2025
941aa15
Enhance Makefile and test scripts for improved test management. Added…
livingkurt Apr 30, 2025
d6852db
Refactor Makefile to simplify test command execution. Updated test ta…
livingkurt Apr 30, 2025
0706dc9
Remove unnecessary test file exclusion from .gitignore to ensure all …
livingkurt Apr 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ jobs:
name: helioscli-artifacts
path: ./HeliosCLI
- name: Set execute permissions for test script
run: chmod +x ./runtests.sh
run: chmod +x ./run_tests.sh
working-directory: tests
- name: Run general tests
run: ./runtests.sh
run: ./run_tests.sh
working-directory: tests

embedded:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
name: helioscli-artifacts
path: ./HeliosCLI
- name: Set execute permissions for test script
run: chmod +x ./runtests.sh
run: chmod +x ./run_tests.sh
working-directory: tests
- name: Run general tests
run: ./runtests.sh
run: ./run_tests.sh
working-directory: tests

embedded:
Expand Down
78 changes: 62 additions & 16 deletions HeliosCLI/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ ifneq ($(INCLUDES),)
CFLAGS+=$(INCLUDES)
endif

# Architecture passed from parent Makefile (default to x64 if run standalone)
ARCH ?= x64

# Build and Output directories relative to this Makefile
BUILD_DIR = $(ARCH)
OUTPUT_DIR = output
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output must also be arch-specific, otherwise say you have x86/x64 you can't build them side by side.

Either the binary name or the output folder needs to reflect the arch.

You could do away with output/ entirely and just dump the binary in the arch directory with the object files, that's kinda fine too.

FINAL_TARGET = $(OUTPUT_DIR)/helios_cli

# local NONSTANDARD libraries to link with
# these MUST be exact filenames, cannot be -l syntax
# for example:
Expand All @@ -59,13 +67,19 @@ else
$(shell find . -type f -name '*.cpp')
endif

# object files are source files with .c replaced with .o
OBJS=\
$(SRC:.cpp=.o) \
# Separate source files by directory
HELIOS_SRC = $(shell find ../Helios -type f -name '*.cpp')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit I've let you flail around a bit with this because I've been too busy to give you proper direction.

You've done an amazing job so far with my half-assed comments, I commend you.

So what would normally happen in this case is you wouldn't build the helios src files with this makefile, like I said this is the spaghetti you don't really want.

This makefile only really needs to track it's own sources and object files, then in order to get HeliosLib into HeliosCli you need to turn HeliosLib into a true lib and link the library in this makefile

The Makefile in HeliosLib/ needs to be able to produce a static library out of the code there, on linux this looks like HeliosLib.a or something like that.

The reason that I never really bothered with this part is because it doesn't exactly matter but now that you're fixing these makefiles we might as well solve the problem.

Here is an example makefile that produces a static lib by using 'ar' to combine all the .obj files together and produce the .a:

# Example Makefile section

# Source and output definitions
SRCS := file1.cpp file2.cpp file3.cpp
OBJS := $(SRCS:.cpp=.o)
LIB  := libmylibrary.a

# Compiler and archiver
CXX  := g++
AR   := ar
CXXFLAGS := -O2 -Wall -std=c++17

# Target: build static library
$(LIB): $(OBJS)
	$(AR) rcs $@ $^

# Rule to compile .cpp to .o
%.o: %.cpp
	$(CXX) $(CXXFLAGS) -c $< -o $@

# Clean target
clean:
	rm -f $(OBJS) $(LIB)

I just grabbed this from gpt the part you would be adapting would be the $(LIB): $(OBJS)

That would be like:

LIB = HeliosLib.a

And this would also be able to build for x86 or x64....

But here's where things get a little funky...


The Embedded Build

Yeah, so, HeliosEmbedded also does this same thing of building the src files from the other folder... but that's because I don't know if using ar to make an archive/static lib out of helios then linking that into the HeliosEmbedded entrypoint would cause different results in optimizations for size.

Like, if you build a static library the ar tool doesn't discriminate which functions/things to keep. There's no optimization in terms of trimming away useless functions when making a static lib.

I don't know if the optimizer would work the same for the avr build if we simply linked HeliosLib.a (in avr arch) with the main.o for the embedded entrypoint.

In theory, it should work the same... but I didn't feel like testing it in case it ended up being a waste of time.

Anyway sorry if this is a bit of a rant my brain is cooked today but I wanted to try and help you out.

Copy link
Collaborator

@Unreal-Dan Unreal-Dan May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be a bit more clear, it absolutely should work fine to build the static lib with avr arch and just link it with the heliosembedded main.o -- I was probably more lazy than worried it wouldn't work

the ar tool is just archiving, ie putting all the obj files together into a single archive file. Linking a .a I believe follows the same procedure as .o files.

Here I got some more gpt crap:

project/
├── lib/
│   ├── Makefile      # Builds libmylibrary.a
│   ├── file1.cpp
│   ├── file2.cpp
├── app/
│   ├── main.cpp      # Uses libmylibrary.a
│   ├── Makefile      # Builds the binary

So the lib/Makefile is like HeliosLib like the one in the above example I gave.

Then the app that pulls on the lib is like HeliosCli or HeliosEmbedded:

# app/Makefile

# Compiler setup
CC := g++
CXXFLAGS := -O2 -Wall -std=c++17

# Output binary
TARGET := myapp

# Source files
SRC := main.cpp
OBJ := $(SRC:.cpp=.o)
DFILES := $(SRC:.cpp=.d)

# Static library (exact path, not -l syntax)
LIBS := ../lib/libmylibrary.a

# Combined dependencies
DEPS := $(OBJ) $(LIBS)

.PHONY: all clean

all: $(TARGET)

$(TARGET): $(DEPS)
	$(CC) $(CXXFLAGS) -o $@ $(OBJ) $(LIBS)

%.o: %.cpp
	$(CC) $(CXXFLAGS) -MMD -c $< -o $@

# Auto-build any .a static lib from its folder
%.a:
	$(MAKE) -C $(dir $@) $(notdir $@)

clean:
	rm -f $(OBJ) $(TARGET) $(DFILES)
	$(MAKE) -C $(dir $(LIBS)) clean

# Auto-include generated dependency files (ignore missing ones)
-include $(DFILES)

This above example is slightly tailored, it uses some of the tricks I've shown like the DFILES and it also uses a trick to build the static lib:

%.a:
	$(MAKE) -C $(dir $@) $(notdir $@)

This target catches all libs and runs make in the directory of $@ (so the libs folder) on the lib name.

So in Helios for example it would run:

make -C ../HeliosLib HeliosLib.a 

Then ../HeliosLib/HeliosLib.a can simply be put at the end of the compiler command like

$(LD) $(OBJS) -o $@ $(LIBS)

which would be:

ld main.o -o helios_cli ../HeliosLib/HeliosLib.a

you can interchange LD with g++ in the above example btw. g++ understands if it receives obj files it will just passthrough to LD.

LOCAL_SRC = $(shell find . -type f -name '*.cpp')

# dependency files are source files with .c replaced with .d
DFILES=\
$(SRC:.cpp=.d) \
# Generate object file paths using BUILD_DIR
HELIOS_OBJS = $(patsubst ../Helios/%.cpp,$(BUILD_DIR)/Helios/%.o,$(HELIOS_SRC))
LOCAL_OBJS = $(patsubst ./%.cpp,$(BUILD_DIR)/%.o,$(LOCAL_SRC))
OBJS = $(HELIOS_OBJS) $(LOCAL_OBJS)

# dependency files
HELIOS_DFILES = $(patsubst ../Helios/%.cpp,$(BUILD_DIR)/Helios/%.d,$(HELIOS_SRC))
LOCAL_DFILES = $(patsubst ./%.cpp,$(BUILD_DIR)/%.d,$(LOCAL_SRC))
DFILES = $(HELIOS_DFILES) $(LOCAL_DFILES)

# target dependencies
# this includes any script generated c/h files,
Expand All @@ -87,12 +101,18 @@ all: $(TARGETS)
# unit test target
tests: $(TESTS)

# target for vortex lib
# target for helios cli
helios: compute_version $(DEPS)
$(CC) $(CFLAGS) $(DEPS) -o $@ $(LLIBS)
@mkdir -p $(OUTPUT_DIR)
$(CC) $(CFLAGS) $(OBJS) -o $(FINAL_TARGET) $(LLIBS)

# catch-all make target to generate .o and .d files
%.o: %.cpp
# Rules for building object files
$(BUILD_DIR)/Helios/%.o: ../Helios/%.cpp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so in theory this shouldn't exist, all building of HeliosLib stuff should be in the makefile that is in that folder

@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -MMD -c $< -o $@

$(BUILD_DIR)/%.o: ./%.cpp
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -MMD -c $< -o $@

# catch-all for static libraries in the form of:
Expand All @@ -107,7 +127,8 @@ FORCE:

# generic clean target
clean:
@$(RM) $(DFILES) $(OBJS) $(TARGETS) $(TESTS)
@$(RM) -rf $(BUILD_DIR) $(OUTPUT_DIR)
@$(RM) -f $(DFILES) $(OBJS) $(TESTS)

compute_version:
$(eval LATEST_TAG ?= $(shell git fetch --depth=1 origin +refs/tags/*:refs/tags/* &> /dev/null && git tag --list | sort -V | tail -n1))
Expand All @@ -121,18 +142,43 @@ compute_version:
$(eval HELIOS_BUILD_NUMBER := $(if $(HELIOS_BUILD_NUMBER),$(HELIOS_BUILD_NUMBER),0))
$(eval HELIOS_VERSION_NUMBER := $(HELIOS_VERSION_MAJOR).$(HELIOS_VERSION_MINOR).$(HELIOS_BUILD_NUMBER))

# generate bmps
bmps:
./PatternGenerator/generate_bmps.sh -c

# generate svg
svgs: bmps
./generate_svgs.sh
./PatternGenerator/generate_svgs.sh

# generate pngs
pngs: bmps
./generate_pngs.sh
./PatternGenerator/generate_pngs.sh

# generate pngs
bmps:
./generate_bmps.sh -c
# record tests
record_tests: all
../tests/record_tests.sh

# record test
record_test: all
../tests/record_test.sh

# run tests
run_tests: all
../tests/run_tests.sh

# create_tests
create_tests: all
../tests/create_test.sh

# export tests
export_tests: all
../tests/export_tests.sh

# import tests
import_tests: all
../tests/import_tests.sh

# clean storage
clean_storage:
@echo "Cleaning Helios storage file..."
@$(RM) Helios.storage
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
83 changes: 61 additions & 22 deletions HeliosEmbedded/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,33 @@ CFLAGS+=$(INCLUDES)
### SOURCE FILES ######
#######################

# Architecture passed from parent Makefile (default to avr if run standalone)
ARCH ?= avr

# Build and Output directories relative to this Makefile
BUILD_DIR = $(ARCH)
LOCAL_OUTPUT_DIR = output

# Source files
ifeq ($(OS),Windows_NT) # Windows
SRCS = \
$(shell find ../Helios -maxdepth 1 -type f -name '\*.cpp') main.cpp
else # linux
SRCS = \
$(shell find ../Helios -maxdepth 1 -type f -name \*.cpp) main.cpp
HELIOS_SRCS = \
$(shell find ../Helios -maxdepth 1 -type f -name '\*.cpp')
LOCAL_SRCS = main.cpp
else # linux/macos
HELIOS_SRCS = \
$(shell find ../Helios -maxdepth 1 -type f -name \*.cpp)
LOCAL_SRCS = main.cpp
endif

OBJS = $(SRCS:.cpp=.o)
# Generate object file paths using BUILD_DIR
HELIOS_OBJS = $(patsubst ../Helios/%.cpp,$(BUILD_DIR)/Helios/%.o,$(HELIOS_SRCS))
LOCAL_OBJS = $(patsubst %.cpp,$(BUILD_DIR)/%.o,$(LOCAL_SRCS))
OBJS = $(HELIOS_OBJS) $(LOCAL_OBJS)

DFILES = $(SRCS:.cpp=.d)
# Generate dependency file paths
HELIOS_DFILES = $(patsubst ../Helios/%.cpp,$(BUILD_DIR)/Helios/%.d,$(HELIOS_SRCS))
LOCAL_DFILES = $(patsubst %.cpp,$(BUILD_DIR)/%.d,$(LOCAL_SRCS))
DFILES = $(HELIOS_DFILES) $(LOCAL_DFILES)

#######################
### BUILD TARGETS #####
Expand All @@ -161,30 +176,50 @@ DFILES = $(SRCS:.cpp=.d)
# Target name
TARGET = helios

all: compute_version $(TARGET).hex
# Define final hex target (still goes to root output)
ROOT_OUTPUT_DIR = ../output # This needs to stay for the root makefile to copy
FINAL_HEX_TARGET = $(ROOT_OUTPUT_DIR)/helios_firmware.hex # Keep final target name

# Define targets for intermediate files in local output
LOCAL_ELF_TARGET = $(LOCAL_OUTPUT_DIR)/$(TARGET).elf
LOCAL_BIN_TARGET = $(LOCAL_OUTPUT_DIR)/$(TARGET).bin
LOCAL_EEP_TARGET = $(LOCAL_OUTPUT_DIR)/$(TARGET).eep
LOCAL_LST_TARGET = $(LOCAL_OUTPUT_DIR)/$(TARGET).lst
LOCAL_MAP_TARGET = $(LOCAL_OUTPUT_DIR)/$(TARGET).map

all: compute_version $(FINAL_HEX_TARGET)
@echo Detected Operating System: $(OS)
$(OBJDUMP) --disassemble --source --line-numbers --demangle --section=.text $(TARGET).elf > $(TARGET).lst
$(NM) --numeric-sort --line-numbers --demangle --print-size --format=s $(TARGET).elf > $(TARGET).map
$(OBJDUMP) --disassemble --source --line-numbers --demangle --section=.text $(LOCAL_ELF_TARGET) > $(LOCAL_LST_TARGET)
$(NM) --numeric-sort --line-numbers --demangle --print-size --format=s $(LOCAL_ELF_TARGET) > $(LOCAL_MAP_TARGET)
chmod +x avrsize.sh
./avrsize.sh $(TARGET).elf
./avrsize.sh $(LOCAL_ELF_TARGET)
@echo "== Success building Helios v$(HELIOS_VERSION_NUMBER) =="

$(TARGET).hex: $(TARGET).elf
$(OBJCOPY) -O binary -R .eeprom $(TARGET).elf $(TARGET).bin
$(OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $(TARGET).elf $(TARGET).eep
$(OBJCOPY) -O ihex -R .eeprom $< $@
$(FINAL_HEX_TARGET): $(LOCAL_ELF_TARGET)
@mkdir -p $(dir $@)
@mkdir -p $(LOCAL_OUTPUT_DIR)
$(OBJCOPY) -O binary -R .eeprom $< $(LOCAL_BIN_TARGET)
$(OBJCOPY) -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 $< $(LOCAL_EEP_TARGET)
$(OBJCOPY) -O ihex -R .eeprom $< ../output/helios_firmware.hex
@echo "Created final hex: ../output/helios_firmware.hex"

$(TARGET).elf: compute_version $(OBJS)
$(LOCAL_ELF_TARGET): compute_version $(OBJS)
@mkdir -p $(dir $@)
$(LD) $(LDFLAGS) $(OBJS) -o $@

%.o: %.S
$(CC) $(ASMFLAGS) -c $< -o $@
# Rules for building object files
$(BUILD_DIR)/Helios/%.o: ../Helios/%.cpp
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) -MM -MT "$@" -MF "$(BUILD_DIR)/Helios/$*.d" $<

%.o: %.cpp
$(BUILD_DIR)/%.o: %.cpp
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
$(CC) $(CFLAGS) -MM -MT "$@" -MF "$(BUILD_DIR)/$*.d" $<

upload: set_fuses $(TARGET).hex
$(AVRDUDE) $(AVRDUDE_FLAGS) -Uflash:w:$(TARGET).hex:i
upload: set_fuses $(FINAL_HEX_TARGET)
$(AVRDUDE) $(AVRDUDE_FLAGS) -Uflash:w:$(FINAL_HEX_TARGET):i

#######################
### LINUX SETUP #######
Expand Down Expand Up @@ -284,7 +319,11 @@ extract_hex: helios_firmware.hex
#####################

clean:
rm -f $(OBJS) $(TARGET).elf $(TARGET).hex $(DFILES) $(TARGET).bin $(TARGET).eep $(TARGET).lst $(TARGET).map
@echo "Cleaning up HeliosEmbedded..."
@$(RM) -rf $(BUILD_DIR) $(LOCAL_OUTPUT_DIR)
@$(RM) -f $(OBJS) $(DFILES) # Keep FINAL_HEX_TARGET out of here, root cleans it
@$(RM) -f *.d ../Helios/*.d
@echo "Cleaned HeliosEmbedded!"

compute_version:
$(eval LATEST_TAG ?= $(shell git fetch --depth=1 origin +refs/tags/*:refs/tags/* &> /dev/null && git tag --list | sort -V | tail -n1))
Expand Down
72 changes: 51 additions & 21 deletions HeliosLib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,36 @@ LLIBS=\
LIBS=\
$(LLIBS) \

# Architecture passed from parent Makefile (default to x64 if run standalone)
ARCH ?= x64

# Build and Output directories relative to this Makefile
BUILD_DIR = $(ARCH)
OUTPUT_DIR = output
FINAL_LIB_TARGET = $(OUTPUT_DIR)/helios_lib.a
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh neat, a static lib, LOL

FINAL_WASM_TARGET = $(OUTPUT_DIR)/helios_wasm.js
FINAL_WASM_BIN_TARGET = $(OUTPUT_DIR)/helios_wasm.wasm

# source files
# local source files first, other sources after
ifeq ($(OS),Windows_NT)
SRC = $(shell find ../Helios/ -type f -name \\*.cpp) HeliosLib.cpp
HELIOS_SRC = $(shell find ../Helios/ -type f -name \\*.cpp)
LOCAL_SRC = HeliosLib.cpp
else
SRC = $(shell find ../Helios/ -type f -name '*.cpp') HeliosLib.cpp
HELIOS_SRC = $(shell find ../Helios/ -type f -name '*.cpp')
LOCAL_SRC = HeliosLib.cpp
endif

# object files are source files with .c replaced with .o
OBJS=\
$(SRC:.cpp=.o) \
# Generate object file paths using BUILD_DIR
HELIOS_OBJS = $(patsubst ../Helios/%.cpp,$(BUILD_DIR)/Helios/%.o,$(HELIOS_SRC))
LOCAL_OBJS = $(patsubst %.cpp,$(BUILD_DIR)/%.o,$(LOCAL_SRC))
OBJS = $(HELIOS_OBJS) $(LOCAL_OBJS)

# dependency files are source files with .c replaced with .d
DFILES=\
$(SRC:.cpp=.d) \
# Generate dependency file paths
HELIOS_DFILES = $(patsubst ../Helios/%.cpp,$(BUILD_DIR)/Helios/%.d,$(HELIOS_SRC))
LOCAL_DFILES = $(patsubst %.cpp,$(BUILD_DIR)/%.d,$(LOCAL_SRC))
DFILES = $(HELIOS_DFILES) $(LOCAL_DFILES)

# target dependencies
# this includes any script generated c/h files,
# the $(LLIBS) list, and the $(OBJS) list
DEPS=\
$(LLIBS) \
$(OBJS) \
Expand All @@ -94,10 +105,9 @@ TESTS=\

# target files
ifdef WASM
TARGETS=HeliosLib.js \
helios.a
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohhhhhhh I already had a helios.a being generated, well I'm ahead of myself then

TARGETS=$(FINAL_WASM_TARGET) $(FINAL_LIB_TARGET)
else
TARGETS=helios.a
TARGETS=$(FINAL_LIB_TARGET)
endif

# Default target for 'make' command
Expand All @@ -108,25 +118,45 @@ tests: $(TESTS)

# force sub-build of wasm
wasm: FORCE
env WASM=1 $(MAKE)
@if command -v em++; then \
echo "WebAssembly compiler found, building WASM..."; \
env ARCH=wasm WASM=1 $(MAKE) $(FINAL_WASM_TARGET) $(FINAL_LIB_TARGET); \
else \
echo "WebAssembly compiler (em++) not found, skipping WASM build."; \
mkdir -p $(OUTPUT_DIR); \
touch $(FINAL_WASM_TARGET); \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these here? If it's skipping the wasm build in this section why mkdir and touch files?

touch $(FINAL_WASM_BIN_TARGET); \
fi

# target for helios lib
helios.a: compute_version $(DEPS)
$(FINAL_LIB_TARGET): compute_version $(DEPS)
@mkdir -p $(dir $@)
$(AR) $@ $(DEPS)
@echo "Created $@"

HeliosLib.js: compute_version $(DEPS)
# target for HeliosLib.js
$(FINAL_WASM_TARGET): compute_version $(DEPS)
@mkdir -p $(dir $@)
$(CC) $(LDFLAGS) $(DEPS) -o $@ $(LLIBS)

# catch-all make target to generate .o and .d files
%.o: %.cpp
# Rules for building object files
$(BUILD_DIR)/Helios/%.o: ../Helios/%.cpp
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -MMD -c $< -o $@

$(BUILD_DIR)/%.o: %.cpp
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -MMD -c $< -o $@

# Empty rule that forces %.a to run all the time
# Empty rule that forces .a to run all the time
FORCE:

# generic clean target
clean:
@$(RM) $(DFILES) $(OBJS) $(TARGETS) $(TESTS) HeliosLib.js HeliosLib.wasm
@echo "Cleaning up HeliosLib..."
@$(RM) -rf $(BUILD_DIR) $(OUTPUT_DIR)
@$(RM) -f $(DFILES) $(OBJS) $(TESTS) HeliosLib.js HeliosLib.wasm # Remove old possible output names
@echo "Cleaned HeliosLib!"

compute_version:
$(eval LATEST_TAG ?= $(shell git fetch --depth=1 origin +refs/tags/*:refs/tags/* &> /dev/null && git tag --list | sort -V | tail -n1))
Expand Down
Loading
Loading