0

I am having multiple 'C' files in '/home/user/openwrt/package/utils/C_script/src/one.c two.c three.c upto ten.c in the same path. Inside I have written Makefile to compile C files in order. Like

one: one.c
    $(CC) $(LDFLAG) -o one one.c
two: two.c
    $(CC) $(LDFLAG) -o two two.c

upto ten files. How to write Makefile in openWRT to compile 10 files individually and bring 10 individual ipk package and push all the 10 executable in /usr/local/bin.

Renaud Pacalet
  • 25,260
  • 3
  • 34
  • 51
Mohammed Harris
  • 326
  • 6
  • 25
  • 1
    You could start with [pattern rules](https://www.gnu.org/software/make/manual/make.html#Pattern-Rules). – Renaud Pacalet Nov 30 '18 at 15:33
  • Thanks @Renaud.Now out of that 10 files one file needs a extra flag as pthread. If i pass the argument in the compilation as -pthread, first file itself failing as there is not pthread.h available.Out of that 10 files only one file is requires -pthread argument. How to compile using pattern rules. – Mohammed Harris Dec 02 '18 at 11:36
  • 1
    This is where [target-specific variables](https://www.gnu.org/software/make/manual/make.html#Target_002dspecific) enter the picture. – Renaud Pacalet Dec 02 '18 at 11:39

0 Answers0