# 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) # Compiler settings CC = sdcc # sdcc compiler CFLAGS = -mmcs51 -DSDCC $(INCLUDE_DIRS) # add include paths to compiler flags # Source files (all .c files in the directory) SRC=$(wildcard *.c) # 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) OBJS = $(SRC:.c=.o) # Output file OUTPUT=output.ihx # 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 %.o: %.c $(HEADERS) $(CC) $(CFLAGS) -c $< -o $@ # Clean generated files clean: rm -f $(OUTPUT) $(OBJS) *.asm *.lst *.sym