2

For the earlier psets, no makefile is present yet make runs without problems. How?

2
  • make has its default configurations. Also, the make you use in earlier psets is aliased to make with certain variables in the command line itself.
    – rigel
    Commented Nov 21, 2014 at 7:45
  • reddit.com/r/cs50/comments/1ujct6/… check the part where they alias make50
    – rigel
    Commented Nov 21, 2014 at 7:47

2 Answers 2

3

If there's no Makefile in the same directory as the program that you're trying to compile, make uses its default configuration. In the appliance, make uses some environment variables to run the compilation command that you see on .c files. For more information about these variables, see Variables Used by Implicit Rules!

1

When run without a makefile, Make takes its cues from environment variables set in your shell (specifically, those loaded in (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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .