Files
zigbee_weather_station/Makefile
T

38 lines
1.0 KiB
Makefile
Raw Normal View History

# Path to Z-Stack SDK
ZSTACK_DIR = ./include
# Include path for the Z-Stack SDK
# INCLUDE_DIRS = -I$(ZSTACK_DIR)/Components/hal/CC2530 \
# -I$(ZSTACK_DIR)/Components/zigbee
INCLUDE_DIRS = -I$(ZSTACK_DIR)
2025-02-22 11:15:35 +01:00
# Compiler settings
CC = sdcc # sdcc compiler
2025-02-23 20:53:04 +01:00
CFLAGS = -mmcs51 -DSDCC $(INCLUDE_DIRS) # add include paths to compiler flags
2025-02-23 20:53:04 +01:00
# Source files (all .c files in the directory)
SRC=$(wildcard *.c)
2025-02-23 20:53:04 +01:00
# Headers
HEADERS = main.h zigbee_comm.h sensors/bme280.h sensors/wind_vane.h sensors/rain_gauge.h sensors/anemometer.h config.h include/hal_types.h include/hal_defs.h include/hal_timer.h include/ZComDef.h include/OSAL.h include/i2c.h
# Object files (replace .c with .o)
2025-02-23 20:53:04 +01:00
OBJS = $(SRC:.c=.o)
# Output file
OUTPUT=output.ihx
2025-02-22 11:15:35 +01:00
# Default target: compile and generate the hex file
all: $(OUTPUT)
# Rule to build the output file
$(OUTPUT): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $(OUTPUT)
# Rule to build object files from source files
2025-02-22 11:15:35 +01:00
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
# Clean generated files
clean:
rm -f $(OUTPUT) $(OBJS) *.asm *.lst *.sym