Arduino-Makefile icon indicating copy to clipboard operation
Arduino-Makefile copied to clipboard

No rule to make a user library header file

Open naterenegar opened this issue 7 years ago • 1 comments

I'm trying to write a library for some motors.
Here's the my main directory:

├── build-uno
├── lib
├── main.h
├── main.ino
└── Makefile

And here's the library setup:

lib
└── motor
    ├── motor.c
    └── motor.h

Here's the output when I run make:

-------------------------
Arduino.mk Configuration:
- [AUTODETECTED]       CURRENT_OS = LINUX 
- [AUTODETECTED]       ARDUINO_DIR = /usr/share/arduino 
- [COMPUTED]           ARDMK_DIR = /home/nrenegar/git/Arduino-Makefile (relative to Common.mk)
- [AUTODETECTED]       ARDUINO_VERSION = 166 
- [DEFAULT]            ARCHITECTURE = avr 
- [DEFAULT]            ARDMK_VENDOR = arduino 
- [AUTODETECTED]       ARDUINO_PREFERENCES_PATH = /home/nrenegar/.arduino15/preferences.txt 
- [AUTODETECTED]       ARDUINO_SKETCHBOOK = /home/nrenegar/Arduino (from arduino preferences file)
- [AUTODETECTED]       AVR_TOOLS_DIR = /usr (found in $PATH)
- [COMPUTED]           ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [COMPUTED]           ARDUINO_PLATFORM_LIB_PATH = /usr/share/arduino/hardware/arduino/avr/libraries (from ARDUINO_DIR)
- [COMPUTED]           ARDUINO_VAR_PATH = /usr/share/arduino/hardware/arduino/avr/variants (from ARDUINO_DIR)
- [COMPUTED]           BOARDS_TXT = /usr/share/arduino/hardware/arduino/avr/boards.txt (from ARDUINO_DIR)
- [USER]               USER_LIB_PATH = /home/nrenegar/git/OSVCode/main/lib 
- [DEFAULT]            PRE_BUILD_HOOK = pre-build-hook.sh 
- [USER]               BOARD_TAG = uno 
- [COMPUTED]           CORE = arduino (from build.core)
- [COMPUTED]           VARIANT = standard (from build.variant)
- [COMPUTED]           OBJDIR = build-uno (from BOARD_TAG)
- [COMPUTED]           ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino/avr/cores/arduino (from ARDUINO_DIR, BOARD_TAG and boards.txt)
- [ASSUMED]            MONITOR_BAUDRATE = 9600 
- [DEFAULT]            OPTIMIZATION_LEVEL = s 
- [DEFAULT]            MCU_FLAG_NAME = mmcu 
- [DEFAULT]            CFLAGS_STD = -std=gnu11 
- [DEFAULT]            CXXFLAGS_STD = -std=gnu++11 
- [AUTODETECTED]       DEVICE_PATH = /dev/ttyACM0 
- [DEFAULT]            FORCE_MONITOR_PORT =  
- [AUTODETECTED]       Size utility: AVR-aware for enhanced output
-
-                      ARDUINO_LIBS =
- [USER]                 motor
- [COMPUTED]           BOOTLOADER_PARENT = /usr/share/arduino/hardware/arduino/avr/bootloaders (from ARDUINO_DIR)
- [COMPUTED]           ARDMK_VERSION = 1.6 
- [COMPUTED]           CC_VERSION = 6.3.0 (avr-gcc)
-------------------------
mkdir -p build-uno
make: *** No rule to make target 'motor.h', needed by 'build-uno/main.ino.o'.  Stop.

I'm not sure why it can't make.

naterenegar avatar Apr 12 '18 17:04 naterenegar

~~This used to work and bisect points the finger at abbd020 (Preserve source extension for object files., 2015-07-09) where it broke.~~

Oops, sorry, forget it, I messed up the bisection by not running make clean in my project.

@naterenegar Have you built your project in the past with your motor.c and motor.h files being right next to your main.ino? I did that in my project, and after I moved the source files of my library to ./libraries/, I got the same error as you when running make USER_LIB_PATH=./libraries to try it out. It turns out I should have run make clean first, after that the build went just fine.

szeder avatar Apr 21 '18 05:04 szeder