Skip to content

Commit 733f5f8

Browse files
authored
Merge pull request #1334 from SpiNNakerManchester/clean
Clean
2 parents a3e4568 + a4364b6 commit 733f5f8

20 files changed

Lines changed: 98 additions & 65 deletions

File tree

.github/workflows/c_actions.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,12 @@ jobs:
4242
with:
4343
base-dir: c_common/models
4444

45-
- name: Build C Code
45+
- name: Build and insert C Code
4646
env:
4747
SPINN_INSTALL_DIR: ${{ github.workspace }}/spinnaker_tools_install
4848
SPINN_COMMON_INSTALL_DIR: ${{ github.workspace }}/spinn_common_install
4949
FEC_INSTALL_DIR: ${{ github.workspace }}/fec_install
5050
CFLAGS: -fdiagnostics-color=always
51-
C_LOGS_DICT: ${{ github.workspace }}/spinn_front_end_common/common_model_binaries/logs.sqlite3
52-
run: |
53-
make -C spinnaker_tools install
54-
make -C spinn_common install
55-
make -C c_common
56-
57-
- name: Build C Code central install
58-
env:
59-
SPINN_DIRS: ${{ github.workspace }}/spinn_dirs
60-
CFLAGS: -fdiagnostics-color=always
61-
C_LOGS_DICT: ${{ github.workspace }}/spinn_front_end_common/common_model_binaries/logs.sqlite3
6251
run: |
6352
make -C spinnaker_tools install
6453
make -C spinn_common install
@@ -74,5 +63,5 @@ jobs:
7463
name: fec_binaries
7564
path: |
7665
spinn_front_end_common/common_model_binaries/*.aplx
77-
spinn_front_end_common/common_model_binaries/logs.sqlite3
66+
spinn_front_end_common/common_model_binaries/logs*.sqlite3
7867
retention-days: 5

.github/workflows/publish.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ jobs:
3737
with:
3838
repository: SpiNNakerManchester/SupportScripts
3939
path: support
40-
- name: Set dynamic environment variables
41-
run: |
42-
echo "SPINN_DIRS=$PWD/spinnaker_tools" >> $GITHUB_ENV
4340

4441
- name: Checkout SpiNNaker Dependencies
4542
uses: SpiNNakerManchester/SupportScripts/actions/install-spinn-deps@main

c_common/Makefile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
INSTALL_DIRS = front_end_common_lib
16-
BUILD_DIRS = models
15+
DIRS = front_end_common_lib models
1716

1817
# Locations of tag files
1918
TAGFILES=sllt.tag common.tag
@@ -23,16 +22,16 @@ COMMON_TAG=https://spinnakermanchester.github.io/spinn_common/common.tag
2322
DOXYGEN ?= doxygen
2423
WGET ?= wget
2524

26-
all: install build
25+
all: build
2726

28-
build: install $(BUILD_DIRS)
29-
@for d in $(BUILD_DIRS); do $(MAKE) -C $$d || exit $$?; done
27+
build: $(DIRS)
28+
@for d in $(DIRS); do $(MAKE) -C $$d || exit $$?; done
3029

31-
install: $(INSTALL_DIRS)
32-
@for d in $(INSTALL_DIRS); do $(MAKE) -C $$d install || exit $$?; done
30+
install: $(DIRS)
31+
@for d in $(DIRS); do $(MAKE) -C $$d install || exit $$?; done
3332

34-
clean: $(BUILD_DIRS)
35-
@for d in $(BUILD_DIRS) $(INSTALL_DIRS); do $(MAKE) -C $$d clean || exit $$?; done
33+
clean: $(DIRS)
34+
@for d in $(DIRS); do $(MAKE) -C $$d clean || exit $$?; done
3635

3736
sllt.tag: .sllt_template.tag
3837
cp .sllt_template.tag sllt.tag

c_common/front_end_common_lib/Makefile

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# If SPINN_COMMON_INSTALL_DIR is not defined, this is also an error!
16-
SPINN_COMMON_INSTALL_DIR := $(strip $(if $(SPINN_COMMON_INSTALL_DIR), $(SPINN_COMMON_INSTALL_DIR), $(if $(SPINN_DIRS), $(SPINN_DIRS)/spinn_common_install, $(error SPINN_COMMON_INSTALL_DIR or SPINN_DIRS is not set. Please define SPINN_COMMON_INSTALL_DIR or SPINN_DIRS))))
17-
1815
FEC_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
1916
FEC_BUILD = $(FEC_DIR)/build
17+
FEC_LIB = $(FEC_DIR)/lib
2018
override LIB := 1
19+
20+
SPINN_COMMON_INSTALL_DIR := $(strip $(if $(SPINN_COMMON_INSTALL_DIR), $(SPINN_COMMON_INSTALL_DIR), $(abspath $(FEC_DIR)../../../spinn_common)))
21+
2122
include $(SPINN_COMMON_INSTALL_DIR)/make/spinn_common.mk
2223

2324
ifndef PRINT_DEBUG
@@ -46,39 +47,47 @@ INSTALL ?= install
4647

4748
# Variables needed for file converter
4849
SRC_DIR = $(FEC_DIR)/src/
49-
MODIFIED_DIR = $(FEC_BUILD)/modified_src/
50+
MODIFIED_DIR = $(FEC_BUILD)/modified_src/
5051

5152
# Build rules (default)
52-
$(FEC_BUILD)/$(APP).a: $(BUILD_OBJS)
53+
$(FEC_LIB)/$(APP).a: $(BUILD_OBJS)
5354
$(MKDIR) $(FEC_BUILD)
55+
$(MKDIR) $(FEC_LIB)
5456
@$(RM) $@
5557
$(AR) $@ $(BUILD_OBJS)
5658

59+
APP_OUTPUT_DIR := $(FEC_DIR)../../spinn_front_end_common/common_model_binaries/
60+
# key for the database in this APP_OUTPUT_DIR
61+
DATABASE_KEY = C
5762
$(MODIFIED_DIR)%.c: $(RAW_DIR)
58-
python -m spinn_utilities.make_tools.converter $(SRC_DIR) $(MODIFIED_DIR) True
63+
python -m spinn_utilities.make_tools.converter $(SRC_DIR) $(MODIFIED_DIR) $(APP_OUTPUT_DIR) $(DATABASE_KEY)
5964

6065
$(FEC_BUILD)/%.o: $(MODIFIED_DIR)/%.c
6166
$(CC) $(CFLAGS) -o $@ $<
6267

68+
INSTALL_ERROR := c_common/front_end_common_lib install is only required if you are building in a temporary location.
69+
INSTALL_ERROR += In which case you must set the environment variable FEC_INSTALL_DIR to where the install should go.
70+
INSTALL_ERROR += This environment variable must also exist for all higher level makes.
71+
6372
# Installing rules
64-
install: $(FEC_BUILD)/$(APP).a
65-
$(eval FEC_INSTALL_DIR := $(strip $(if $(FEC_INSTALL_DIR), $(FEC_INSTALL_DIR), $(if $(SPINN_DIRS), $(SPINN_DIRS)/fec_install, $(error FEC_INSTALL_DIR or SPINN_DIRS is not set. Please define FEC_INSTALL_DIR or SPINN_DIRS)))))
73+
install: $(FEC_LIB)/$(APP).a
74+
$(eval FEC_INSTALL_DIR := $(strip $(if $(FEC_INSTALL_DIR), $(FEC_INSTALL_DIR), $(error $(INSTALL_ERROR)))))
6675
$(MKDIR) $(FEC_INSTALL_DIR)/lib
6776
$(MKDIR) $(FEC_INSTALL_DIR)/include
6877
$(MKDIR) $(FEC_INSTALL_DIR)/make
6978
$(INSTALL) -c -m644 $< $(FEC_INSTALL_DIR)/lib
7079
$(INSTALL) -c -m644 $(HEADERS:%=$(FEC_DIR)/include/%) $(FEC_INSTALL_DIR)/include
71-
$(INSTALL) -c -m644 $(FEC_DIR)/fec.mk $(FEC_INSTALL_DIR)/make
80+
$(INSTALL) -c -m644 $(FEC_DIR)/make/fec.mk $(FEC_INSTALL_DIR)/make
7281

7382
clean:
74-
$(RM) $(FEC_BUILD)/$(APP).a $(BUILD_OBJS)
83+
$(RM) $(FEC_LIB)/$(APP).a $(BUILD_OBJS)
7584
rm -rf $(MODIFIED_DIR)
76-
$(RM) $(FEC_BUILD)/logs.sqlite3
85+
$(RM) $(APP_OUTPUT_DIR)logs*.sqlite3
86+
$(RM) $(APP_OUTPUT_DIR)*.aplx
7787

7888
.PRECIOUS: $(MODIFIED_DIR)%.c $(BUILD_DIR)%.nm $(BUILD_DIR)%.elf $(BUILD_DIR)%.bin
7989

8090
.PHONY: clean install
8191

8292
test:
83-
#$(APP_OUTPUT_DIR)$(APP).dict
8493
#$(INSTALL_LIBS)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.a
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# FEC_INSTALL_DIR must be set for this file to be found
16-
17-
# We also need SPINN_COMMON_INSTALL_DIR for common library
18-
SPINN_COMMON_INSTALL_DIR := $(strip $(if $(SPINN_COMMON_INSTALL_DIR), $(SPINN_COMMON_INSTALL_DIR), $(if $(SPINN_DIRS), $(SPINN_DIRS)/spinn_common_install, $(error SPINN_COMMON_INSTALL_DIR or SPINN_DIRS is not set. Please define SPINN_COMMON_INSTALL_DIR or SPINN_DIRS))))
19-
2015
# Find out where we are installed now (in the make subdirectory, so go up one)
2116
FEC_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../)
2217

@@ -27,7 +22,13 @@ ifndef APP_OUTPUT_DIR
2722
endif
2823
APP_OUTPUT_DIR := $(abspath $(APP_OUTPUT_DIR))/
2924

30-
# APP name for a and dict files
25+
ifndef DATABASE_KEY
26+
# Makes in https://github.com/orgs/SpiNNakerManchester should user Upper case letters
27+
# So each user APP_OUTPUT_DIR should have a unique lower case one to avoid clashes
28+
$(error DATABASE_KEY is not set. Please set it to a unique lower case letter)
29+
endif
30+
31+
# APP name for a files
3132
ifndef APP
3233
$(error APP is not set. Please define APP)
3334
endif
@@ -69,12 +70,12 @@ get_path = $(abspath $(word $2, $(subst :, ,$1)))/
6970
# directory pair
7071
define add_source_dir#(src_dir)
7172
$(call get_path,$(1),2): $(wildcard $(call get_path,$(1),1)/**/*)
72-
python -m spinn_utilities.make_tools.converter $(call get_path,$(1),1) $(call get_path,$(1),2)
73+
python -m spinn_utilities.make_tools.converter $(call get_path,$(1),1) $(call get_path,$(1),2) $(APP_OUTPUT_DIR) $(DATABASE_KEY)
7374

7475
$(call get_path,$(1), 2)%.c: $(call get_path,$(1), 1)%.c
75-
python -m spinn_utilities.make_tools.converter $(call get_path,$(1),1) $(call get_path,$(1),2)
76+
python -m spinn_utilities.make_tools.converter $(call get_path,$(1),1) $(call get_path,$(1),2) $(APP_OUTPUT_DIR) $(DATABASE_KEY)
7677
$(call get_path,$(1), 2)%.h: $(call get_path,$(1), 1)%.h
77-
python -m spinn_utilities.make_tools.converter $(call get_path,$(1),1) $(call get_path,$(1),2)
78+
python -m spinn_utilities.make_tools.converter $(call get_path,$(1),1) $(call get_path,$(1),2) $(APP_OUTPUT_DIR) $(DATABASE_KEY)
7879

7980
# Build the o files from the modified sources
8081
$$(BUILD_DIR)%.o: $(call get_path,$(1),2)%.c
@@ -135,9 +136,7 @@ $(foreach d, $(SOURCE_DIRS), \
135136
$(eval $(call add_source_dir, $(d))))
136137
OBJECTS += $(_OBJS)
137138

139+
SPINN_COMMON_INSTALL_DIR := $(strip $(if $(SPINN_COMMON_INSTALL_DIR), $(SPINN_COMMON_INSTALL_DIR), $(abspath $(FEC_DIR)/../../../spinn_common)))
140+
138141
# Bring in the common makefile
139142
include $(SPINN_COMMON_INSTALL_DIR)/make/spinn_common.mk
140-
141-
# Tidy and cleaning dependencies
142-
clean:
143-
$(RM) $(TEMP_FILES) $(OBJECTS) $(BUILD_DIR)$(APP).elf $(BUILD_DIR)$(APP).txt $(ALL_TARGETS) $(BUILD_DIR)$(APP).nm $(BUILD_DIR)$(APP).elf $(BUILD_DIR)$(APP).bin

c_common/models/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ BUILD_DIRS = compressors \
1919
reverse_iptag_multicast_source \
2020
system_models
2121

22+
install: all
23+
2224
all: $(BUILD_DIRS)
2325
@for d in $(BUILD_DIRS); do $(MAKE) -C $$d || exit $$?; done
2426

c_common/models/chip_power_monitor/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
CUR_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
16+
1517
APP = chip_power_monitor
1618
SOURCES = chip_power_monitor.c
1719

1820
include ../fec_models.mk
21+
22+
clean:
23+
$(RM) -r $(CUR_DIR)/build

c_common/models/command_sender_multicast_source/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
CUR_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
16+
1517
APP = command_sender_multicast_source
1618
SOURCES = command_sender_multicast_source.c
1719

1820
include ../fec_models.mk
21+
22+
clean:
23+
$(RM) -r $(CUR_DIR)/build

c_common/models/compressors/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ APPS = simple_pair_compressor.mk \
1818
all: $(APPS)
1919
for f in $(APPS); do $(MAKE) -f $$f || exit $$?; done
2020

21-
clean: $(DIRS)
22-
for f in $(APPS); do $(MAKE) -f $$f clean || exit $$?; done
21+
CUR_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
22+
23+
clean:
24+
$(RM) -r $(CUR_DIR)/build

0 commit comments

Comments
 (0)