1

Bit of a noob question but I'm building an app in react native and to make development a bit faster I'm using a make file for arbitrary commands. I need to run an executable in a sub-directory but can't get this to work while using the Makefile command.

The command works when I cd into the directory then run it but this doesn't work when I use the exact same commands for the make command and I'm sure there's a one line answer to this somewhere but I haven't been able to find it.

Doing this works

user@device:~/project$  cd android
user@device:~/project/android$  ./gradlew assembleRelease

but having it in the makefile like so doesn't

///////// Start of Makefile /////
apk:
    cd android/
    ./gradlew assembleRelease

///// End of file ///////

user@device:~/project$  make apk
ya_boi
  • 13
  • 5

1 Answers1

0

Why not just use android/gradlew assembleRelease?

There is some good info elsewhere on SO about why commands like cd won't work as expected in a makefile.

Kai
  • 2,529
  • 1
  • 15
  • 24
  • assembleRelease is also in the android directory and whenever I run the command I get this error ```Task 'android/assembleRelease' not found in root project``` I thought as much when I was putting ```cd``` into the Makefile that I was definitely doing something wrong but I'm stumped as to how to reference both the executable and the file I'm passing to it. – ya_boi Mar 22 '19 at 18:55
  • more potentially related stuff: https://stackoverflow.com/questions/51397363/task-assemblerelease-not-found-in-root-project-android – Kai Mar 22 '19 at 19:08