3

I was trying to do a lot of the work on my pc instead of the appliance and I would really like to use the make functionality.

Currently when I run make it doesn't have the correct flags and I was hoping to find out how I can modify my own to make that of the appliance. I am assuming it uses a makefile but cant find it on either my pc or the appliance. Thanks for any help.

2
  • In the appliance, I think things are a little simplified for us (like, there's not always a makefile but make still works), but in general, the command make executes commands in the "makefile", which is a file you should write, title Makefile, and put in the directory with the source code you want to compile. There's a manual for the make command, including everything about how to write your own Makefile available here: gnu.org/software/make/manual
    – postylem
    Commented Sep 13, 2014 at 13:00
  • also, here's a good chapter on make: oreilly.com/catalog/make3/book/ch01.pdf
    – postylem
    Commented Sep 13, 2014 at 13:05

2 Answers 2

5

When run without a makefile, Make takes its cues from environment variables set in your shell (specifically, those loaded in /etc/profile.d/appliance50.sh).

To get the same behavior from Make as it has in the CS50 Appliance, you can add the following to your .bashrc (or .zshrc, etc, if you're using a different shell):

export CC=clang  
export CFLAGS="-ggdb3 -O0 -std=c99 -Wall -Werror"
export LDLIBS="-lcs50 -lm"

(Note that we're using clang, not gcc, in CS50.)

See here for a description of what these flags mean.

source: Compile using make without the appliance in Kubuntu

0

Alternatively, you can add this to your bashrc:

alias make="CC='clang' CFLAGS='-ggdb3 -O0 -std=c99 -Wall -Werror' LDLIBS='-lcs50 -lm' make"

2
  • what is the last portion of your statement make" doing. After LDLIBS='-lcs50 -lm' you have this ----> make" what is that last make doing there?
    – BluePython
    Commented Sep 13, 2015 at 23:20
  • it's running make
    – dkinzer
    Commented Sep 15, 2015 at 23:27

You must log in to answer this question.